Tests: (org-ql-it) Expand using Buttercup's it

As the implementation of `it' changes, this will change with
it (correctly).
This commit is contained in:
Adam Porter 2023-03-09 00:52:47 -06:00
parent 6c9c0b957a
commit 0304a2c9dc

View file

@ -112,20 +112,17 @@ FILENAME should be a file in the \"tests\" directory."
;;;; Macros ;;;; Macros
(defmacro org-ql-it (description &rest body) (defmacro org-ql-it (description &rest body)
"Expand to two specs, one of which tests with preambles and the other without. "Expand to two specs, one of which tests with preambles and the other without."
Based on Buttercup macro `it'."
(declare (indent 1) (debug (&define sexp def-body))) (declare (indent 1) (debug (&define sexp def-body)))
(if body `(progn
`(progn (it ,(concat description " (preamble) ")
(buttercup-it ,(concat description " (preamble) ") ,(when body
(lambda () `(let ((org-ql-use-preamble t))
(let ((org-ql-use-preamble t)) ,@body)))
,@body))) (it ,(concat description " (no preamble) ")
(buttercup-it ,(concat description " (no preamble)") ,(when body
(lambda () `(let ((org-ql-use-preamble nil))
(let ((org-ql-use-preamble nil)) ,@body)))) )
,@body))))
`(buttercup-xit ,description)))
(cl-defmacro org-ql-expect (ql-args results &key (buffer 'org-ql-test-buffer)) (cl-defmacro org-ql-expect (ql-args results &key (buffer 'org-ql-test-buffer))
"Expand to `expect' test form that expects QL-ARGS to equal RESULTS. "Expand to `expect' test form that expects QL-ARGS to equal RESULTS.