Change: Rename --plain-query to --query-string-to-sexp
This commit is contained in:
parent
3024f8bc9a
commit
8cf4e65ef0
5 changed files with 37 additions and 37 deletions
|
|
@ -327,60 +327,60 @@ 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")
|
||||
(expect (org-ql--query-string-to-sexp "todo: !todo:CHECK,SOMEDAY")
|
||||
:to-equal '(and (todo) (not (todo "CHECK" "SOMEDAY"))))
|
||||
(expect (org-ql--plain-query "!todo:CHECK,SOMEDAY todo:")
|
||||
(expect (org-ql--query-string-to-sexp "!todo:CHECK,SOMEDAY todo:")
|
||||
:to-equal '(and (not (todo "CHECK" "SOMEDAY")) (todo)))
|
||||
(expect (org-ql--plain-query "tags:universe !moon")
|
||||
(expect (org-ql--query-string-to-sexp "tags:universe !moon")
|
||||
:to-equal '(and (tags "universe") (not (regexp "moon"))))
|
||||
(expect (org-ql--plain-query "!moon tags:universe")
|
||||
(expect (org-ql--query-string-to-sexp "!moon tags:universe")
|
||||
:to-equal '(and (not (regexp "moon")) (tags "universe")))
|
||||
(expect (org-ql--plain-query "mars !ts:on=today")
|
||||
(expect (org-ql--query-string-to-sexp "mars !ts:on=today")
|
||||
:to-equal '(and (regexp "mars") (not (ts :on "today"))))
|
||||
(expect (org-ql--plain-query "!\"quoted phrase\"")
|
||||
(expect (org-ql--query-string-to-sexp "!\"quoted phrase\"")
|
||||
:to-equal '(not (regexp "quoted phrase"))))
|
||||
(it "Regexp predicates"
|
||||
(expect (org-ql--plain-query "scheduled")
|
||||
(expect (org-ql--query-string-to-sexp "scheduled")
|
||||
;; No colon after keyword, so not a predicate query.
|
||||
:to-equal '(regexp "scheduled"))
|
||||
(expect (org-ql--plain-query "\"quoted phrase\"")
|
||||
(expect (org-ql--query-string-to-sexp "\"quoted phrase\"")
|
||||
:to-equal '(regexp "quoted phrase"))
|
||||
(expect (org-ql--plain-query "regexp:word")
|
||||
(expect (org-ql--query-string-to-sexp "regexp:word")
|
||||
:to-equal '(regexp "word"))
|
||||
(expect (org-ql--plain-query "regexp:\"quoted phrase\"")
|
||||
(expect (org-ql--query-string-to-sexp "regexp:\"quoted phrase\"")
|
||||
:to-equal '(regexp "quoted phrase")))
|
||||
(it "Timestamp-based predicates"
|
||||
(expect (org-ql--plain-query "scheduled:on=2017-07-07")
|
||||
(expect (org-ql--query-string-to-sexp "scheduled:on=2017-07-07")
|
||||
:to-equal '(scheduled :on "2017-07-07"))
|
||||
(expect (org-ql--plain-query "deadline:from=2017-07-07,to=2017-07-09")
|
||||
(expect (org-ql--query-string-to-sexp "deadline:from=2017-07-07,to=2017-07-09")
|
||||
:to-equal '(deadline :from "2017-07-07" :to "2017-07-09"))
|
||||
(expect (org-ql--plain-query "planning:from=2017-07-07")
|
||||
(expect (org-ql--query-string-to-sexp "planning:from=2017-07-07")
|
||||
:to-equal '(planning :from "2017-07-07"))
|
||||
(expect (org-ql--plain-query "closed:from=2017-07-07")
|
||||
(expect (org-ql--query-string-to-sexp "closed:from=2017-07-07")
|
||||
:to-equal '(closed :from "2017-07-07"))
|
||||
(expect (org-ql--plain-query "ts-active:to=2017-07-07")
|
||||
(expect (org-ql--query-string-to-sexp "ts-active:to=2017-07-07")
|
||||
:to-equal '(ts-active :to "2017-07-07"))
|
||||
(expect (org-ql--plain-query "ts-inactive:to=2017-07-07")
|
||||
(expect (org-ql--query-string-to-sexp "ts-inactive:to=2017-07-07")
|
||||
:to-equal '(ts-inactive :to "2017-07-07"))
|
||||
(expect (org-ql--plain-query "ts-a:to=2017-07-07")
|
||||
(expect (org-ql--query-string-to-sexp "ts-a:to=2017-07-07")
|
||||
:to-equal '(ts-a :to "2017-07-07"))
|
||||
(expect (org-ql--plain-query "ts-i:on=2017-07-07")
|
||||
(expect (org-ql--query-string-to-sexp "ts-i:on=2017-07-07")
|
||||
:to-equal '(ts-i :on "2017-07-07"))
|
||||
(expect (org-ql--plain-query "ts:")
|
||||
(expect (org-ql--query-string-to-sexp "ts:")
|
||||
:to-equal '(ts))
|
||||
(expect (org-ql--plain-query "clocked:")
|
||||
(expect (org-ql--query-string-to-sexp "clocked:")
|
||||
:to-equal '(clocked)))
|
||||
(it "To-do predicates"
|
||||
(expect (org-ql--plain-query "todo:")
|
||||
(expect (org-ql--query-string-to-sexp "todo:")
|
||||
:to-equal '(todo))
|
||||
(expect (org-ql--plain-query "todo:TODO")
|
||||
(expect (org-ql--query-string-to-sexp "todo:TODO")
|
||||
:to-equal '(todo "TODO"))
|
||||
(expect (org-ql--plain-query "todo:TODO,SOMEDAY")
|
||||
(expect (org-ql--query-string-to-sexp "todo:TODO,SOMEDAY")
|
||||
:to-equal '(todo "TODO" "SOMEDAY")))
|
||||
(it "Compound queries"
|
||||
(expect (org-ql--plain-query "todo:SOMEDAY ts-a:from=2020-01-01,to=2021-01-01")
|
||||
(expect (org-ql--query-string-to-sexp "todo:SOMEDAY ts-a:from=2020-01-01,to=2021-01-01")
|
||||
:to-equal '(and (todo "SOMEDAY") (ts-a :from "2020-01-01" :to "2021-01-01")))
|
||||
(expect (org-ql--plain-query "regexp:\"quoted phrase\" todo:SOMEDAY")
|
||||
(expect (org-ql--query-string-to-sexp "regexp:\"quoted phrase\" todo:SOMEDAY")
|
||||
:to-equal '(and (regexp "quoted phrase") (todo "SOMEDAY")))))
|
||||
|
||||
(describe "Convert sexp queries to non-sexp queries"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue