Add: Negation in plain queries

This commit is contained in:
Adam Porter 2019-10-09 19:05:11 -05:00
parent 6b2004e678
commit 949a06c3ab
4 changed files with 43 additions and 21 deletions

View file

@ -231,6 +231,17 @@ RESULTS should be a list of strings as returned by
;; TODO: Other predicates.
(it "Negated terms"
(expect (org-ql--plain-query "todo: !todo:CHECK,SOMEDAY")
:to-equal '(and (todo) (not (todo "CHECK" "SOMEDAY"))))
(expect (org-ql--plain-query "!todo:CHECK,SOMEDAY todo:")
:to-equal '(and (not (todo "CHECK" "SOMEDAY")) (todo)))
(expect (org-ql--plain-query "tags:universe !moon")
:to-equal '(and (tags "universe") (not (regexp "moon"))))
(expect (org-ql--plain-query "!moon tags:universe")
:to-equal '(and (not (regexp "moon")) (tags "universe")))
(expect (org-ql--plain-query "mars !ts:on=today")
:to-equal '(and (regexp "mars") (not (ts :on "today")))))
(it "Regexp predicates"
(expect (org-ql--plain-query "scheduled")
;; No colon after keyword, so not a predicate query.