Tests: Wrap bare (expect) forms in (it) forms
This commit is contained in:
parent
36e97d51cf
commit
c7fab9dfce
1 changed files with 41 additions and 31 deletions
|
|
@ -252,18 +252,24 @@ with keyword arg NOW in PLIST."
|
||||||
:to-equal '(org-ql--predicate-outline-path "a\\." "b"))))
|
:to-equal '(org-ql--predicate-outline-path "a\\." "b"))))
|
||||||
|
|
||||||
(describe "(tags-inherited)"
|
(describe "(tags-inherited)"
|
||||||
(expect (org-ql--normalize-query '(tags-inherited))
|
(it "handles 0 arguments"
|
||||||
:to-equal '(tags-inherited))
|
(expect (org-ql--normalize-query '(tags-inherited))
|
||||||
(expect (org-ql--normalize-query '(itags))
|
:to-equal '(tags-inherited)))
|
||||||
:to-equal '(tags-inherited))
|
(it "handles 1 argument"
|
||||||
(expect (org-ql--normalize-query '(tags-inherited "foo"))
|
(expect (org-ql--normalize-query '(tags-inherited "foo"))
|
||||||
:to-equal '(tags-inherited "foo"))
|
:to-equal '(tags-inherited "foo")))
|
||||||
(expect (org-ql--normalize-query '(itags "foo"))
|
(it "handles 2 arguments"
|
||||||
:to-equal '(tags-inherited "foo"))
|
(expect (org-ql--normalize-query '(tags-inherited "foo" "bar"))
|
||||||
(expect (org-ql--normalize-query '(tags-inherited "foo" "bar"))
|
:to-equal '(tags-inherited "foo" "bar")))
|
||||||
:to-equal '(tags-inherited "foo" "bar"))
|
(it "aliases to `itags'"
|
||||||
(expect (org-ql--normalize-query '(itags "foo" "bar"))
|
(expect (org-ql--normalize-query '(itags))
|
||||||
:to-equal '(tags-inherited "foo" "bar")))
|
:to-equal '(tags-inherited)))
|
||||||
|
(it "aliases to `itags' with one argument"
|
||||||
|
(expect (org-ql--normalize-query '(itags "foo"))
|
||||||
|
:to-equal '(tags-inherited "foo")))
|
||||||
|
(it "aliases to `itags' with two arguments"
|
||||||
|
(expect (org-ql--normalize-query '(itags "foo" "bar"))
|
||||||
|
:to-equal '(tags-inherited "foo" "bar"))))
|
||||||
|
|
||||||
(describe "timestamp predicates"
|
(describe "timestamp predicates"
|
||||||
;; NOTE: (clocked) and (closed) don't accept :with-time arguments.
|
;; NOTE: (clocked) and (closed) don't accept :with-time arguments.
|
||||||
|
|
@ -456,25 +462,29 @@ with keyword arg NOW in PLIST."
|
||||||
:to-equal `(ts :from ,(ts-inc 'day 1 beg-of-today-ts)
|
:to-equal `(ts :from ,(ts-inc 'day 1 beg-of-today-ts)
|
||||||
:to ,(ts-inc 'day 1 end-of-today-ts)))))))
|
:to ,(ts-inc 'day 1 end-of-today-ts)))))))
|
||||||
|
|
||||||
(expect (org-ql--normalize-query '(and "string1" "string2"))
|
(describe "Plain strings"
|
||||||
:to-equal '(and (regexp "string1") (regexp "string2")))
|
(it "normalizes plain strings to the default predicate (using AND)"
|
||||||
(expect (org-ql--normalize-query '(or "string1" "string2"))
|
(expect (org-ql--normalize-query '(and "string1" "string2"))
|
||||||
:to-equal '(or (regexp "string1") (regexp "string2")))
|
:to-equal '(and (regexp "string1") (regexp "string2"))))
|
||||||
(expect (org-ql--normalize-query '(and (todo "TODO")
|
(it "normalizes plain strings to the default predicate (using OR)"
|
||||||
(or "string1" "string2")))
|
(expect (org-ql--normalize-query '(or "string1" "string2"))
|
||||||
:to-equal '(and (todo "TODO") (or (regexp "string1") (regexp "string2"))))
|
:to-equal '(or (regexp "string1") (regexp "string2"))))
|
||||||
(expect (org-ql--normalize-query '(when (todo "TODO")
|
(it "normalizes plain strings within sub-expressions to the default predicate"
|
||||||
(or "string1" "string2")))
|
(expect (org-ql--normalize-query '(and (todo "TODO")
|
||||||
:to-equal '(when (todo "TODO") (or (regexp "string1") (regexp "string2"))))
|
(or "string1" "string2")))
|
||||||
(expect (org-ql--normalize-query '(when "string-cond1"
|
:to-equal '(and (todo "TODO") (or (regexp "string1") (regexp "string2"))))
|
||||||
(or "string1" "string2")))
|
(expect (org-ql--normalize-query '(when (todo "TODO")
|
||||||
:to-equal '(when (regexp "string-cond1") (or (regexp "string1") (regexp "string2"))))
|
(or "string1" "string2")))
|
||||||
(expect (org-ql--normalize-query '(when (and "string-cond1" "string-cond2")
|
:to-equal '(when (todo "TODO") (or (regexp "string1") (regexp "string2"))))
|
||||||
(or "string1" "string2")))
|
(expect (org-ql--normalize-query '(when "string-cond1"
|
||||||
:to-equal '(when (and (regexp "string-cond1") (regexp "string-cond2")) (or (regexp "string1") (regexp "string2"))))
|
(or "string1" "string2")))
|
||||||
(expect (org-ql--normalize-query '(unless (and "stringcondition1" "stringcond2")
|
:to-equal '(when (regexp "string-cond1") (or (regexp "string1") (regexp "string2"))))
|
||||||
(or "string1" "string2")))
|
(expect (org-ql--normalize-query '(when (and "string-cond1" "string-cond2")
|
||||||
:to-equal '(unless (and (regexp "stringcondition1") (regexp "stringcond2")) (or (regexp "string1") (regexp "string2"))))
|
(or "string1" "string2")))
|
||||||
|
:to-equal '(when (and (regexp "string-cond1") (regexp "string-cond2")) (or (regexp "string1") (regexp "string2"))))
|
||||||
|
(expect (org-ql--normalize-query '(unless (and "stringcondition1" "stringcond2")
|
||||||
|
(or "string1" "string2")))
|
||||||
|
:to-equal '(unless (and (regexp "stringcondition1") (regexp "stringcond2")) (or (regexp "string1") (regexp "string2"))))))
|
||||||
|
|
||||||
;; FIXME: This test fails, but only on GitHub CI; it works fine
|
;; FIXME: This test fails, but only on GitHub CI; it works fine
|
||||||
;; locally. It seems to be something to do with Buttercup and
|
;; locally. It seems to be something to do with Buttercup and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue