diff --git a/org-ql.el b/org-ql.el index c638f4d..f6639c4 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1668,6 +1668,8 @@ element should be a regexp string." ;; This section implements parsing of "plain," non-Lisp queries using the `peg' ;; library. NOTE: This needs to appear after the predicates are defined. +;; TODO: Rename "plain" to "string", or something like that. + (require 'peg) ;; Fix compiler warnings probably caused by `peg' not using lexical-binding. @@ -1749,6 +1751,75 @@ Multiple predicates are combined with BOOLEAN." (org-ql--def-plain-query-fn)) +;; And now we go the other direction... + +(defun org-ql--query-sexp-to-string (query) + "Return a string query for sexp QUERY. +If QUERY can't be converted to a string, return nil." + ;; This started out pretty simple...but at least it's not just one long function, right? + (cl-labels ((complex-p (query) + (or (contains-p 'or query))) + (contains-p (symbol list) + (cl-loop for element in list + thereis (or (eq symbol element) + (and (listp element) + (contains-p symbol element))))) + (format-args + (args) (let (non-paired paired next-keyword) + (cl-loop for arg in args + do (cond (next-keyword (push (cons next-keyword arg) paired) + (setf next-keyword nil)) + ((keywordp arg) (setf next-keyword (substring (symbol-name arg) 1))) + (t (push arg non-paired)))) + (string-join (append (mapcar #'format-atom non-paired) + (nreverse (--map (format "%s=%s" (car it) (cdr it)) + paired))) + ","))) + (format-atom + (atom) (cl-typecase atom + (string (if (string-match (rx space) atom) + (format "%S" atom) + (format "%s" atom))) + (t (format "%s" atom)))) + (format-form + (form) (pcase form + (`(not . (,rest)) (concat "!" (format-form rest))) + (`(priority . ,_) (format-priority form)) + ;; FIXME: Convert (src) queries to non-sexp form...someday... + (`(src . ,_) (user-error "Converting (src ...) queries to non-sexp form is not implemented")) + (_ (pcase-let* ((`(,pred . ,args) form) + (args-string (pcase args + ('() "") + ((guard (= 1 (length args))) (format "%s" (car args))) + (_ (format-args args))))) + (format "%s:%s" pred args-string))))) + (format-and + (form) (pcase-let* ((`(and . ,rest) form)) + (string-join (mapcar #'format-form rest) " "))) + (format-priority + (form) (pcase-let* ((`(priority . ,rest) form) + (args (pcase rest + (`(,(and comparator (or '< '<= '> '>= '=)) ,letter) + (priority-letters comparator letter)) + (_ rest)))) + (concat "priority:" (string-join args ",")))) + (priority-letters + (comparator letter) (let* ((char (string-to-char (upcase (symbol-name letter)))) + (numeric-priorities '(?A ?B ?C)) + ;; NOTE: The comparator inversion is intentional. + (others (pcase comparator + ('< (--select (> it char) numeric-priorities)) + ('<= (--select (>= it char) numeric-priorities)) + ('> (--select (< it char) numeric-priorities)) + ('>= (--select (<= it char) numeric-priorities)) + ('= (--select (= it char) numeric-priorities))))) + (mapcar #'char-to-string others)))) + ;; FIXME: Error out for ts structs passed to `ts' predicate (very unlikely to be linked to). + (unless (complex-p query) + (pcase query + (`(and . ,_) (format-and query)) + (_ (format-form query)))))) + ;;;; Footer (provide 'org-ql) diff --git a/tests/test-org-ql.el b/tests/test-org-ql.el index c28d728..93a042d 100644 --- a/tests/test-org-ql.el +++ b/tests/test-org-ql.el @@ -368,345 +368,392 @@ RESULTS should be a list of strings as returned by (expect (org-ql--plain-query "regexp:\"quoted phrase\" todo:SOMEDAY") :to-equal '(and (regexp "quoted phrase") (todo "SOMEDAY"))))) + (describe "Convert sexp queries to non-sexp queries" + + ;; FIXME: Test (src) after converting it is implemented. + ;; (src :lang "elisp" :regexps ("defun")) + + ;; MAYBE: Other predicates? Or should these cover the other + ;; cases, because the others use the same format? + + (it "(heading)" + (expect (org-ql--query-sexp-to-string '(heading "quoted phrase" "word")) + :to-equal "heading:word,\"quoted phrase\"")) + (it "(priority)" + (expect (org-ql--query-sexp-to-string '(priority >= B)) + :to-equal "priority:A,B") + (expect (org-ql--query-sexp-to-string '(priority > B)) + :to-equal "priority:A") + (expect (org-ql--query-sexp-to-string '(priority < B)) + :to-equal "priority:C") + (expect (org-ql--query-sexp-to-string '(priority < A)) + :to-equal "priority:B,C") + (expect (org-ql--query-sexp-to-string '(priority <= B)) + :to-equal "priority:B,C") + (expect (org-ql--query-sexp-to-string '(priority = A)) + :to-equal "priority:A")) + (it "(todo)" + (expect (org-ql--query-sexp-to-string '(todo)) + :to-equal "todo:") + (expect (org-ql--query-sexp-to-string '(todo "TODO")) + :to-equal "todo:TODO") + (expect (org-ql--query-sexp-to-string '(todo "TODO" "NEXT")) + :to-equal "todo:NEXT,TODO")) + (it "(ts)" + (expect (org-ql--query-sexp-to-string '(ts :from -1 :to 1)) + :to-equal "ts:from=-1,to=1") + (expect (org-ql--query-sexp-to-string '(ts :on today)) + :to-equal "ts:on=today") + (expect (org-ql--query-sexp-to-string '(ts-active :from "2017-01-01" :to "2018-01-01")) + :to-equal "ts-active:from=2017-01-01,to=2018-01-01")) + (it "(and ...)" + (expect (org-ql--query-sexp-to-string '(and (tags "book" "books") (priority "A"))) + :to-equal "tags:books,book priority:A") + (expect (org-ql--query-sexp-to-string '(and (tags "space") (not (regexp "moon")))) + :to-equal "tags:space !regexp:moon")) + (it "(or ...)" + (expect (org-ql--query-sexp-to-string '(or (tags "book" "books") (priority "A"))) + :to-equal nil))) + (describe "Query results" ;; TODO: Other predicates. (describe "(ancestors)" (org-ql-it "without sub-query" - (org-ql-expect ((ancestors)) - '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((ancestors)) + '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with sub-query" - (org-ql-expect ((ancestors (heading "universe"))) - '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) + (org-ql-expect ((ancestors (heading "universe"))) + '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) (describe "(parent)" (org-ql-it "without sub-query" - (org-ql-expect ((parent)) - '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((parent)) + '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with sub-query" - (org-ql-expect ((parent (and (todo) (priority "A")))) - '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) + (org-ql-expect ((parent (and (todo) (priority "A")))) + '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) (describe "(category)" (org-ql-it "without arguments" - (expect (length (org-ql org-ql-test-buffer - (category))) - :to-equal org-ql-test-num-headings)) + (expect (length (org-ql org-ql-test-buffer + (category))) + :to-equal org-ql-test-num-headings)) (org-ql-it "with a category" - (org-ql-expect ((category "ambition")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) + (org-ql-expect ((category "ambition")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")))) (describe "(children)" (org-ql-it "without arguments" - (org-ql-expect ((children)) - '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas"))) + (org-ql-expect ((children)) + '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas"))) (org-ql-it "with sub-query" - (org-ql-expect ((children (todo "CHECK"))) - '("Recurring"))) + (org-ql-expect ((children (todo "CHECK"))) + '("Recurring"))) (org-ql-it "with grandchildren query" - ;; It's really cool how this works. It's so simple. - (org-ql-expect ((children (children "moon"))) - '("Take over the universe")))) + ;; It's really cool how this works. It's so simple. + (org-ql-expect ((children (children "moon"))) + '("Take over the universe")))) (describe "(descendants)" (org-ql-it "without arguments" - (org-ql-expect ((descendants)) - '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas"))) + (org-ql-expect ((descendants)) + '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Recurring" "Ideas"))) (org-ql-it "with sub-query" - (org-ql-expect ((descendants (todo "CHECK"))) - '("Recurring"))) + (org-ql-expect ((descendants (todo "CHECK"))) + '("Recurring"))) (org-ql-it "with granddescendants query" - (org-ql-expect ((descendants (descendants "moon"))) - '("Take over the universe"))) + (org-ql-expect ((descendants (descendants "moon"))) + '("Take over the universe"))) (org-ql-it "with query that should not match parent" - ;; This test would fail if the `descendants' predicate did not properly exclude - ;; the parent heading by narrowing the buffer to begin at the first child. - (org-ql-expect ((and (descendants (todo "WAITING")) - (not (descendants (todo "TODO" "NEXT"))))) - '("Take over the moon")))) + ;; This test would fail if the `descendants' predicate did not properly exclude + ;; the parent heading by narrowing the buffer to begin at the first child. + (org-ql-expect ((and (descendants (todo "WAITING")) + (not (descendants (todo "TODO" "NEXT"))))) + '("Take over the moon")))) (describe "(clocked)" (org-ql-it "without arguments" - (org-ql-expect ((clocked)) - '("Learn universal sign language"))) + (org-ql-expect ((clocked)) + '("Learn universal sign language"))) (org-ql-it "with a number" - (org-ql-then - (org-ql-expect ((clocked 10)) - '("Learn universal sign language")))) + (org-ql-then + (org-ql-expect ((clocked 10)) + '("Learn universal sign language")))) (org-ql-it ":from a timestamp" - (org-ql-expect ((clocked :from "2017-07-05")) - '("Learn universal sign language")) - (org-ql-expect ((clocked :from "2017-07-06")) - nil)) + (org-ql-expect ((clocked :from "2017-07-05")) + '("Learn universal sign language")) + (org-ql-expect ((clocked :from "2017-07-06")) + nil)) (org-ql-it ":from today" - (org-ql-then - (org-ql-expect ((clocked :from today)) - '("Learn universal sign language")))) + (org-ql-then + (org-ql-expect ((clocked :from today)) + '("Learn universal sign language")))) (org-ql-it ":to a timestamp" - (org-ql-expect ((clocked :to "2017-07-05")) - '("Learn universal sign language")) - (org-ql-expect ((clocked :to "2017-07-04")) - nil)) + (org-ql-expect ((clocked :to "2017-07-05")) + '("Learn universal sign language")) + (org-ql-expect ((clocked :to "2017-07-04")) + nil)) (org-ql-it ":to today" - (org-ql-then - (org-ql-expect ((clocked :to today)) - '("Learn universal sign language")))) + (org-ql-then + (org-ql-expect ((clocked :to today)) + '("Learn universal sign language")))) (org-ql-it ":on a date" - (org-ql-expect ((clocked :on "2017-07-05")) - '("Learn universal sign language")) - (org-ql-expect ((clocked :on "2018-12-02")) - nil)) + (org-ql-expect ((clocked :on "2017-07-05")) + '("Learn universal sign language")) + (org-ql-expect ((clocked :on "2018-12-02")) + nil)) (org-ql-it ":on today" - (org-ql-then - (org-ql-expect ((clocked :on today)) - '("Learn universal sign language")))) + (org-ql-then + (org-ql-expect ((clocked :on today)) + '("Learn universal sign language")))) (org-ql-it "within a range (:from and :to)" - (org-ql-expect ((clocked :from "2017-07-04" :to "2018-12-11")) - '("Learn universal sign language")) - (org-ql-expect ((clocked :from "2017-07-06" :to "2018-12-11")) - nil) - (org-ql-expect ((clocked :from "2017-07-01" :to "2017-07-04")) - nil))) + (org-ql-expect ((clocked :from "2017-07-04" :to "2018-12-11")) + '("Learn universal sign language")) + (org-ql-expect ((clocked :from "2017-07-06" :to "2018-12-11")) + nil) + (org-ql-expect ((clocked :from "2017-07-01" :to "2017-07-04")) + nil))) (describe "(closed)" (org-ql-it "without arguments" - (org-ql-expect ((closed)) - '("Learn universal sign language"))) + (org-ql-expect ((closed)) + '("Learn universal sign language"))) (org-ql-it "with a number" - (org-ql-then - (org-ql-expect ((closed 10)) - '("Learn universal sign language")))) + (org-ql-then + (org-ql-expect ((closed 10)) + '("Learn universal sign language")))) (org-ql-it ":on" - (org-ql-expect ((closed :on "2017-07-05")) - '("Learn universal sign language")) - (org-ql-then - (org-ql-expect ((closed :on today)) - '("Learn universal sign language"))) - (org-ql-expect ((closed :on "2019-06-09")) - nil)) + (org-ql-expect ((closed :on "2017-07-05")) + '("Learn universal sign language")) + (org-ql-then + (org-ql-expect ((closed :on today)) + '("Learn universal sign language"))) + (org-ql-expect ((closed :on "2019-06-09")) + nil)) (org-ql-it ":from" - (org-ql-expect ((closed :from "2017-07-04")) - '("Learn universal sign language")) - (org-ql-expect ((closed :from "2017-07-05")) - '("Learn universal sign language")) - (org-ql-then - (org-ql-expect ((closed :from today)) - '("Learn universal sign language"))) - (org-ql-expect ((closed :from "2017-07-06")) - nil)) + (org-ql-expect ((closed :from "2017-07-04")) + '("Learn universal sign language")) + (org-ql-expect ((closed :from "2017-07-05")) + '("Learn universal sign language")) + (org-ql-then + (org-ql-expect ((closed :from today)) + '("Learn universal sign language"))) + (org-ql-expect ((closed :from "2017-07-06")) + nil)) (org-ql-it ":to" - (org-ql-expect ((closed :to "2017-07-04")) - nil) - (org-ql-expect ((closed :to "2017-07-05")) - '("Learn universal sign language")) - (org-ql-then - (org-ql-expect ((closed :to today)) - '("Learn universal sign language"))) - (org-ql-expect ((closed :to "2017-07-06")) - '("Learn universal sign language")))) + (org-ql-expect ((closed :to "2017-07-04")) + nil) + (org-ql-expect ((closed :to "2017-07-05")) + '("Learn universal sign language")) + (org-ql-then + (org-ql-expect ((closed :to today)) + '("Learn universal sign language"))) + (org-ql-expect ((closed :to "2017-07-06")) + '("Learn universal sign language")))) (describe "(deadline)" (org-ql-it "without arguments" - (org-ql-expect ((deadline)) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs"))) + (org-ql-expect ((deadline)) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs"))) (org-ql-it "auto" - (org-ql-then - (org-ql-expect ((deadline auto)) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")))) + (org-ql-then + (org-ql-expect ((deadline auto)) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")))) (org-ql-it "with a number" - (org-ql-then - (org-ql-expect ((deadline 2)) - '("Take over the world" "/r/emacs")))) + (org-ql-then + (org-ql-expect ((deadline 2)) + '("Take over the world" "/r/emacs")))) (org-ql-it ":on" - (org-ql-expect ((deadline :on "2017-07-05")) - '("/r/emacs")) - (org-ql-then - (org-ql-expect ((deadline :on today)) - '("/r/emacs"))) + (org-ql-expect ((deadline :on "2017-07-05")) + '("/r/emacs")) + (org-ql-then + (org-ql-expect ((deadline :on today)) + '("/r/emacs"))) - (org-ql-expect ((deadline :on "2019-06-09")) - nil)) + (org-ql-expect ((deadline :on "2019-06-09")) + nil)) (org-ql-it ":from" - (org-ql-expect ((deadline :from "2017-07-04")) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")) - (org-ql-expect ((deadline :from "2017-07-05")) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")) - (org-ql-expect ((deadline :from "2017-07-06")) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) - (org-ql-expect ((deadline :from "2018-07-06")) - nil) - (org-ql-then - (org-ql-expect ((deadline :from today)) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")))) + (org-ql-expect ((deadline :from "2017-07-04")) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")) + (org-ql-expect ((deadline :from "2017-07-05")) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")) + (org-ql-expect ((deadline :from "2017-07-06")) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) + (org-ql-expect ((deadline :from "2018-07-06")) + nil) + (org-ql-then + (org-ql-expect ((deadline :from today)) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")))) (org-ql-it ":to" - (org-ql-expect ((deadline :to "2017-07-04")) - nil) - (org-ql-expect ((deadline :to "2017-07-05")) - '("/r/emacs")) - (org-ql-expect ((deadline :to "2018-07-06")) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")) - (org-ql-then - (org-ql-expect ((deadline :to today)) - '("/r/emacs"))))) + (org-ql-expect ((deadline :to "2017-07-04")) + nil) + (org-ql-expect ((deadline :to "2017-07-05")) + '("/r/emacs")) + (org-ql-expect ((deadline :to "2018-07-06")) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "/r/emacs")) + (org-ql-then + (org-ql-expect ((deadline :to today)) + '("/r/emacs"))))) (org-ql-it "(done)" - (org-ql-expect ((done)) - '("Learn universal sign language"))) + (org-ql-expect ((done)) + '("Learn universal sign language"))) (org-ql-it "(habit)" - (org-ql-expect ((habit)) - '("Practice leaping tall buildings in a single bound"))) + (org-ql-expect ((habit)) + '("Practice leaping tall buildings in a single bound"))) (describe "(heading)" (org-ql-it "with one argument" - (org-ql-expect ((heading "world")) - ;; NOTE: This--correctly--does not match the "Skype with president of - ;; Antarctica" heading, which has the tag ":world:" in its heading line. - '("Take over the world"))) + (org-ql-expect ((heading "world")) + ;; NOTE: This--correctly--does not match the "Skype with president of + ;; Antarctica" heading, which has the tag ":world:" in its heading line. + '("Take over the world"))) (org-ql-it "with two arguments" - (org-ql-expect ((heading "Take over" "world")) - '("Take over the world")))) + (org-ql-expect ((heading "Take over" "world")) + '("Take over the world")))) (describe "(link)" (org-ql-it "without arguments" - (org-ql-expect ((link)) - '("/r/emacs"))) + (org-ql-expect ((link)) + '("/r/emacs"))) (org-ql-it "with description-or-target" - (org-ql-expect ((link "emacs")) - '("/r/emacs"))) + (org-ql-expect ((link "emacs")) + '("/r/emacs"))) (org-ql-it "with :description" - (org-ql-expect ((link :description "emacs")) - '("/r/emacs"))) + (org-ql-expect ((link :description "emacs")) + '("/r/emacs"))) (org-ql-it "with :target" - (org-ql-expect ((link :target "reddit.com")) - '("/r/emacs"))) + (org-ql-expect ((link :target "reddit.com")) + '("/r/emacs"))) (org-ql-it "with :description and :target" - (org-ql-expect ((link :description "emacs" :target "reddit.com")) - '("/r/emacs")))) + (org-ql-expect ((link :description "emacs" :target "reddit.com")) + '("/r/emacs")))) (describe "(outline-path)" (org-ql-it "with one argument" - (org-ql-expect ((outline-path "symphony")) - '("Write a symphony"))) + (org-ql-expect ((outline-path "symphony")) + '("Write a symphony"))) (org-ql-it "with two arguments" - (org-ql-expect ((outline-path "idea" "symphony")) - '("Write a symphony")))) + (org-ql-expect ((outline-path "idea" "symphony")) + '("Write a symphony")))) (describe "(outline-path-segment)" (org-ql-it "with one argument" - (org-ql-expect ((outline-path-segment "symphony")) - '("Write a symphony"))) + (org-ql-expect ((outline-path-segment "symphony")) + '("Write a symphony"))) (org-ql-it "with a contiguous segment" - (org-ql-expect ((outline-path-segment "idea" "symphony")) - '("Write a symphony"))) + (org-ql-expect ((outline-path-segment "idea" "symphony")) + '("Write a symphony"))) (org-ql-it "with a non-contiguous segment" - (org-ql-expect ((outline-path-segment "data" "symphony")) - nil))) + (org-ql-expect ((outline-path-segment "data" "symphony")) + nil))) (describe "(path)" (org-ql-it "without arguments" - (org-ql-expect ((path)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((path)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with one argument" - (org-ql-expect ((path "data")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((path "data")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with two matching arguments" - (org-ql-expect ((path "data" "tests")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((path "data" "tests")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with two arguments, one matching" - (org-ql-expect ((path "data" "nope")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))) + (org-ql-expect ((path "data" "nope")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))) (describe "(planning)" (org-ql-it "without arguments" - (org-ql-expect ((planning)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) + (org-ql-expect ((planning)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) (org-ql-it "with a number" - (org-ql-then - (org-ql-expect ((planning 2)) - '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-then + (org-ql-expect ((planning 2)) + '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":on" - (org-ql-expect ((planning :on "2017-07-05")) - '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((planning :on "2019-06-09")) - nil) - (org-ql-then - (org-ql-expect ((planning :on today)) - '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((planning :on "2017-07-05")) + '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((planning :on "2019-06-09")) + nil) + (org-ql-then + (org-ql-expect ((planning :on today)) + '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":from" - (org-ql-expect ((planning :from "2017-07-04")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((planning :from "2017-07-05")) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((planning :from "2017-07-06")) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) - (org-ql-then - (org-ql-expect ((planning :from today)) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((planning :from "2017-07-04")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((planning :from "2017-07-05")) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((planning :from "2017-07-06")) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) + (org-ql-then + (org-ql-expect ((planning :from today)) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":to" - (org-ql-expect ((planning :to "2017-07-04")) - '("Skype with president of Antarctica")) - (org-ql-expect ((planning :to "2017-07-05")) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((planning :to "2018-07-06")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-then - (org-ql-expect ((planning :to today)) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))) + (org-ql-expect ((planning :to "2017-07-04")) + '("Skype with president of Antarctica")) + (org-ql-expect ((planning :to "2017-07-05")) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((planning :to "2018-07-06")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-then + (org-ql-expect ((planning :to today)) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))) (describe "(priority)" (org-ql-it "without arguments" - (org-ql-expect ((priority)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor"))) + (org-ql-expect ((priority)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor"))) (org-ql-it "with a priority" - (org-ql-expect ((priority "A")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) + (org-ql-expect ((priority "A")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) (org-ql-it "= a priority" - (org-ql-expect ((priority = "A")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) + (org-ql-expect ((priority = "A")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) (org-ql-it "< a priority" - (org-ql-expect ((priority < "B")) - '("Take over the moon" "Get haircut"))) + (org-ql-expect ((priority < "B")) + '("Take over the moon" "Get haircut"))) (org-ql-it "<= a priority" - (org-ql-expect ((priority <= "B")) - '("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Fix flux capacitor"))) + (org-ql-expect ((priority <= "B")) + '("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Get haircut" "Internet" "Fix flux capacitor"))) (org-ql-it "> a priority" - (org-ql-expect ((priority > "B")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) + (org-ql-expect ((priority > "B")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Spaceship lease"))) (org-ql-it ">= a priority" - (org-ql-expect ((priority >= "B")) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Renew membership in supervillain club" "Learn universal sign language" "Internet" "Spaceship lease" "Fix flux capacitor")))) + (org-ql-expect ((priority >= "B")) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Renew membership in supervillain club" "Learn universal sign language" "Internet" "Spaceship lease" "Fix flux capacitor")))) (describe "(property)" ;; MAYBE: Add support for (property) without arguments. @@ -714,84 +761,84 @@ RESULTS should be a list of strings as returned by ;; (org-ql-expect ((property)))) (org-ql-it "with a property" - (org-ql-expect ((property "agenda-group")) - '("Take over the universe" "Spaceship lease" "Recurring" "Write a symphony"))) + (org-ql-expect ((property "agenda-group")) + '("Take over the universe" "Spaceship lease" "Recurring" "Write a symphony"))) (org-ql-it "with a property and a value" - (org-ql-expect ((property "agenda-group" "plans")) - '("Take over the universe" "Write a symphony")))) + (org-ql-expect ((property "agenda-group" "plans")) + '("Take over the universe" "Write a symphony")))) (describe "(regexp)" (org-ql-it "with 1 argument" - (org-ql-expect ((regexp "Take over") - :sort todo) - '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) + (org-ql-expect ((regexp "Take over") + :sort todo) + '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) (org-ql-it "with 2 arguments" - (org-ql-expect ((regexp "Take over" "universe") - :sort todo) - '("Take over the universe"))) + (org-ql-expect ((regexp "Take over" "universe") + :sort todo) + '("Take over the universe"))) (org-ql-it "with a plain string" - (org-ql-expect ("Take over" - :sort todo) - '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) + (org-ql-expect ("Take over" + :sort todo) + '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) (org-ql-it "with two plain strings in an OR" - (org-ql-expect ((or "Take over" "universe") - :sort todo) - '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) + (org-ql-expect ((or "Take over" "universe") + :sort todo) + '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) (org-ql-it "case-folding predicate with non-case-folding preamble" - ;; e.g. the (todo) predicate disables case-folding in its preamble, but that - ;; should not prevent case-folding in this and other predicates (issue #114). - (org-ql-expect ((and (todo "TODO") (regexp "take over")) - :sort todo) - '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))) + ;; e.g. the (todo) predicate disables case-folding in its preamble, but that + ;; should not prevent case-folding in this and other predicates (issue #114). + (org-ql-expect ((and (todo "TODO") (regexp "take over")) + :sort todo) + '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))) (describe "(scheduled)" (org-ql-it "without arguments" - (org-ql-expect ((scheduled)) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) + (org-ql-expect ((scheduled)) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) (org-ql-it "with a number" - (org-ql-then - ;; Using -1 is the easiest way to exclude some results but not all for testing this. - (org-ql-expect ((scheduled -1)) - '("Skype with president of Antarctica")))) + (org-ql-then + ;; Using -1 is the easiest way to exclude some results but not all for testing this. + (org-ql-expect ((scheduled -1)) + '("Skype with president of Antarctica")))) (org-ql-it ":on" - (org-ql-expect ((scheduled :on "2017-07-05")) - '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((scheduled :on "2019-06-09")) - nil) - (org-ql-then - (org-ql-expect ((scheduled :on today)) - '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((scheduled :on "2017-07-05")) + '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((scheduled :on "2019-06-09")) + nil) + (org-ql-then + (org-ql-expect ((scheduled :on today)) + '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":from" - (org-ql-expect ((scheduled :from "2017-07-04")) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((scheduled :from "2017-07-05")) - '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((scheduled :from "2017-07-06")) - nil) - (org-ql-then - (org-ql-expect ((scheduled :from today)) - '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((scheduled :from "2017-07-04")) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((scheduled :from "2017-07-05")) + '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((scheduled :from "2017-07-06")) + nil) + (org-ql-then + (org-ql-expect ((scheduled :from today)) + '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":to" - (org-ql-expect ((scheduled :to "2017-07-04")) - '("Skype with president of Antarctica")) - (org-ql-expect ((scheduled :to "2017-07-05")) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((scheduled :to "2018-07-06")) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-then - (org-ql-expect ((scheduled :to today)) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))) + (org-ql-expect ((scheduled :to "2017-07-04")) + '("Skype with president of Antarctica")) + (org-ql-expect ((scheduled :to "2017-07-05")) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((scheduled :to "2018-07-06")) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-then + (org-ql-expect ((scheduled :to today)) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "Shop for groceries" "Rewrite Emacs in Common Lisp"))))) ;; TODO: Test (src) predicate. That will require modifying test data, which will be a ;; significant hassle. Manual testing shows that the predicate appears to work properly. @@ -799,288 +846,288 @@ RESULTS should be a list of strings as returned by (describe "(todo)" (org-ql-it "without arguments" - (org-ql-expect ((todo) - :sort todo) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((todo) + :sort todo) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with 1 argument" - (org-ql-expect ((todo "WAITING") - :sort todo) - '("Visit the moon"))) + (org-ql-expect ((todo "WAITING") + :sort todo) + '("Visit the moon"))) (org-ql-it "with 2 arguments" - (org-ql-expect ((todo "WAITING" "SOMEDAY") - :sort todo) - '("Visit the moon" "Rewrite Emacs in Common Lisp" "Write a symphony")))) + (org-ql-expect ((todo "WAITING" "SOMEDAY") + :sort todo) + '("Visit the moon" "Rewrite Emacs in Common Lisp" "Write a symphony")))) (describe "(tags)" (org-ql-it "without arguments" - (org-ql-expect ((tags)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony")) - (org-ql-expect ((not (tags))) - '("Recurring" "Sunrise/sunset" "Ideas"))) + (org-ql-expect ((tags)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony")) + (org-ql-expect ((not (tags))) + '("Recurring" "Sunrise/sunset" "Ideas"))) (org-ql-it "with a tag" - (org-ql-expect ((tags "Emacs")) - '("/r/emacs" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((not (tags "Emacs"))) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) + (org-ql-expect ((tags "Emacs")) + '("/r/emacs" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((not (tags "Emacs"))) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) (org-ql-it "with 2 tags" - (org-ql-expect ((tags "Emacs" "space")) - '("Visit Mars" "Visit the moon" "/r/emacs" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((not (tags "Emacs" "space"))) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) + (org-ql-expect ((tags "Emacs" "space")) + '("Visit Mars" "Visit the moon" "/r/emacs" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((not (tags "Emacs" "space"))) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))) (org-ql-it "with file tags" - (org-ql-expect ((tags "food")) - '("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato") - :buffer (org-ql-test-data-buffer "data2.org")) - (org-ql-expect ((tags "fruit")) - '("Fruit" "Blueberry" "Strawberry") - :buffer (org-ql-test-data-buffer "data2.org")))) + (org-ql-expect ((tags "food")) + '("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato") + :buffer (org-ql-test-data-buffer "data2.org")) + (org-ql-expect ((tags "fruit")) + '("Fruit" "Blueberry" "Strawberry") + :buffer (org-ql-test-data-buffer "data2.org")))) (describe "(tags-inherited)" (org-ql-it "without arguments" - (org-ql-expect ((tags-inherited)) - '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")) - (org-ql-expect ((not (inherited-tags))) - '("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((tags-inherited)) + '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")) + (org-ql-expect ((not (inherited-tags))) + '("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with a tag" - (org-ql-expect ((tags-inherited "Emacs")) - nil) - (org-ql-expect ((itags "ambition")) - '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")) - (org-ql-expect ((not (tags-i "ambition"))) - '("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((tags-inherited "Emacs")) + nil) + (org-ql-expect ((itags "ambition")) + '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language")) + (org-ql-expect ((not (tags-i "ambition"))) + '("Take over the universe" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with 2 tags" - (org-ql-expect ((itags "personal" "world")) - '("Skype with president of Antarctica")) - (org-ql-expect ((not (tags-inherited "personal" "world"))) - ;; Note that this correctly includes the task "Practice leaping...", which has the LOCAL tag "personal". - '("Take over the universe" "Take over the world" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((itags "personal" "world")) + '("Skype with president of Antarctica")) + (org-ql-expect ((not (tags-inherited "personal" "world"))) + ;; Note that this correctly includes the task "Practice leaping...", which has the LOCAL tag "personal". + '("Take over the universe" "Take over the world" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with file tags" - (org-ql-expect ((tags-inherited "food")) - '("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato") - :buffer (org-ql-test-data-buffer "data2.org")) - (org-ql-expect ((tags-inherited "fruit")) - '("Blueberry" "Strawberry") - :buffer (org-ql-test-data-buffer "data2.org")))) + (org-ql-expect ((tags-inherited "food")) + '("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato") + :buffer (org-ql-test-data-buffer "data2.org")) + (org-ql-expect ((tags-inherited "fruit")) + '("Blueberry" "Strawberry") + :buffer (org-ql-test-data-buffer "data2.org")))) (describe "(tags-local)" (org-ql-it "without arguments" - (org-ql-expect ((tags-local)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony")) - (org-ql-expect ((not (local-tags))) - '("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Recurring" "Sunrise/sunset" "Ideas"))) + (org-ql-expect ((tags-local)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp" "Write a symphony")) + (org-ql-expect ((not (local-tags))) + '("Take over Mars" "Take over the moon" "Renew membership in supervillain club" "Learn universal sign language" "Recurring" "Sunrise/sunset" "Ideas"))) (org-ql-it "with a tag" - (org-ql-expect ((tags-local "world")) - '("Take over the world" "Skype with president of Antarctica")) - (org-ql-expect ((ltags "ambition")) - '("Take over the universe")) - (org-ql-expect ((not (tags-l "ambition"))) - '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((tags-local "world")) + '("Take over the world" "Skype with president of Antarctica")) + (org-ql-expect ((ltags "ambition")) + '("Take over the universe")) + (org-ql-expect ((not (tags-l "ambition"))) + '("Take over the world" "Skype with president of Antarctica" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with 2 tags" - (org-ql-expect ((ltags "personal" "world")) - '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Get haircut")) - (org-ql-expect ((not (tags-local "personal" "world"))) - '("Take over the universe" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) + (org-ql-expect ((ltags "personal" "world")) + '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Get haircut")) + (org-ql-expect ((not (tags-local "personal" "world"))) + '("Take over the universe" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))) (org-ql-it "with file tags" - (org-ql-expect ((tags-local "food")) - nil - :buffer (org-ql-test-data-buffer "data2.org")) - (org-ql-expect ((tags-local "fruit")) - '("Fruit") - :buffer (org-ql-test-data-buffer "data2.org")))) + (org-ql-expect ((tags-local "food")) + nil + :buffer (org-ql-test-data-buffer "data2.org")) + (org-ql-expect ((tags-local "fruit")) + '("Fruit") + :buffer (org-ql-test-data-buffer "data2.org")))) (describe "(tags-all), (tags&)" (org-ql-it "with 2 tags" - (org-ql-expect ((tags-all "universe" "personal")) - '("Practice leaping tall buildings in a single bound")) - (org-ql-expect ((tags& "ambition" "space")) - '("Visit Mars" "Visit the moon"))) + (org-ql-expect ((tags-all "universe" "personal")) + '("Practice leaping tall buildings in a single bound")) + (org-ql-expect ((tags& "ambition" "space")) + '("Visit Mars" "Visit the moon"))) (org-ql-it "with file tags" - (org-ql-expect ((tags-all "food" "fruit")) - '("Fruit" "Blueberry" "Strawberry") - :buffer (org-ql-test-data-buffer "data2.org")))) + (org-ql-expect ((tags-all "food" "fruit")) + '("Fruit" "Blueberry" "Strawberry") + :buffer (org-ql-test-data-buffer "data2.org")))) (describe "(ts)" (describe "active" (org-ql-it "without arguments" - (org-ql-expect ((ts :type active)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) + (org-ql-expect ((ts :type active)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) (org-ql-it ":from a timestamp" - (org-ql-expect ((ts :from "2017-07-08" :type active)) - '("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) - (org-ql-expect ((ts :from "2019-06-08" :type active)) - nil) - (org-ql-then - (org-ql-expect ((ts :from today)) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((ts :from "2017-07-08" :type active)) + '("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease")) + (org-ql-expect ((ts :from "2019-06-08" :type active)) + nil) + (org-ql-then + (org-ql-expect ((ts :from today)) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":from a number of days" - (org-ql-then - (org-ql-expect ((ts :from 5)) - '("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "Rewrite Emacs in Common Lisp")))) + (org-ql-then + (org-ql-expect ((ts :from 5)) + '("Take over the universe" "Visit Mars" "Visit the moon" "Renew membership in supervillain club" "Internet" "Spaceship lease" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":to a timestamp" - (org-ql-expect ((ts :to "2019-06-10" :type active)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :to "2017-07-04" :type active)) - '("Skype with president of Antarctica")) - (org-ql-then - (org-ql-expect ((ts :to today)) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((ts :to "2019-06-10" :type active)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :to "2017-07-04" :type active)) + '("Skype with president of Antarctica")) + (org-ql-then + (org-ql-expect ((ts :to today)) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":to a number of days" - (org-ql-then - (org-ql-expect ((ts :to -1)) - '("Skype with president of Antarctica")))) + (org-ql-then + (org-ql-expect ((ts :to -1)) + '("Skype with president of Antarctica")))) (org-ql-it ":on a timestamp" - (org-ql-expect ((ts :on "2017-07-05" :type active)) - '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :on "2019-06-09" :type active)) - nil) - (org-ql-then - (org-ql-expect ((ts :on today)) - '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((ts :on "2017-07-05" :type active)) + '("Practice leaping tall buildings in a single bound" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :on "2019-06-09" :type active)) + nil) + (org-ql-then + (org-ql-expect ((ts :on today)) + '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":on a number of days" - (org-ql-then - (org-ql-expect ((ts-active :on 2)) - '("Take over the world"))))) + (org-ql-then + (org-ql-expect ((ts-active :on 2)) + '("Take over the world"))))) (describe "inactive" (org-ql-it "without arguments" - (org-ql-expect ((ts :type inactive)) - '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))) + (org-ql-expect ((ts :type inactive)) + '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))) (org-ql-it ":from a timestamp" - (org-ql-expect ((ts :from "2017-07-06" :type inactive)) - '("Visit the moon" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :from "2019-06-08" :type inactive)) - nil) - (org-ql-then - (org-ql-expect ((ts-inactive :from today)) - '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((ts :from "2017-07-06" :type inactive)) + '("Visit the moon" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :from "2019-06-08" :type inactive)) + nil) + (org-ql-then + (org-ql-expect ((ts-inactive :from today)) + '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":from a number of days" - (org-ql-then - (org-ql-expect ((ts-i :from 5)) - '("Visit the moon" "Rewrite Emacs in Common Lisp")))) + (org-ql-then + (org-ql-expect ((ts-i :from 5)) + '("Visit the moon" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":to a timestamp" - (org-ql-expect ((ts :to "2019-06-10" :type inactive)) - '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :to "2017-07-04" :type inactive)) - 'nil) - (org-ql-then - (org-ql-expect ((ts-inactive :to today)) - '("Learn universal sign language")))) + (org-ql-expect ((ts :to "2019-06-10" :type inactive)) + '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :to "2017-07-04" :type inactive)) + 'nil) + (org-ql-then + (org-ql-expect ((ts-inactive :to today)) + '("Learn universal sign language")))) (org-ql-it ":to a number of days" - (org-ql-then - (org-ql-expect ((ts-i :to 5)) - '("Learn universal sign language")))) + (org-ql-then + (org-ql-expect ((ts-i :to 5)) + '("Learn universal sign language")))) (org-ql-it ":on a timestamp" - (org-ql-expect ((ts :on "2017-07-05" :type inactive)) - '("Learn universal sign language")) - (org-ql-expect ((ts :on "2019-06-09" :type inactive)) - nil) - (org-ql-then - (org-ql-expect ((ts-inactive :on today)) - '("Learn universal sign language")))) + (org-ql-expect ((ts :on "2017-07-05" :type inactive)) + '("Learn universal sign language")) + (org-ql-expect ((ts :on "2019-06-09" :type inactive)) + nil) + (org-ql-then + (org-ql-expect ((ts-inactive :on today)) + '("Learn universal sign language")))) (org-ql-it ":on a number of days" - (org-ql-then - (org-ql-expect ((ts-inactive :on 19)) - '("Visit the moon" "Rewrite Emacs in Common Lisp"))))) + (org-ql-then + (org-ql-expect ((ts-inactive :on 19)) + '("Visit the moon" "Rewrite Emacs in Common Lisp"))))) (describe "both" (org-ql-it "without arguments" - (org-ql-expect ((ts)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :type both)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) + (org-ql-expect ((ts)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :type both)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))) (org-ql-it ":from a timestamp" - (org-ql-expect ((ts :from "2017-07-05")) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :from "2017-07-05" :type both)) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :from "2019-06-08")) - nil) - (org-ql-expect ((ts :from "2019-06-08" :type both)) - nil) - (org-ql-then - (org-ql-expect ((ts :from today)) - '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((ts :from "2017-07-05")) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :from "2017-07-05" :type both)) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :from "2019-06-08")) + nil) + (org-ql-expect ((ts :from "2019-06-08" :type both)) + nil) + (org-ql-then + (org-ql-expect ((ts :from today)) + '("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":from a number of days" - (org-ql-then - (org-ql-expect ((ts :from -5)) - '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-then + (org-ql-expect ((ts :from -5)) + '("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":to a timestamp" - (org-ql-expect ((ts :to "2017-07-06")) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :to "2017-07-06" :type both)) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :to "2017-07-04")) - '("Skype with president of Antarctica")) - (org-ql-expect ((ts :to "2017-07-04" :type both)) - '("Skype with president of Antarctica")) - (org-ql-then - (org-ql-expect ((ts :to today)) - '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((ts :to "2017-07-06")) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :to "2017-07-06" :type both)) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :to "2017-07-04")) + '("Skype with president of Antarctica")) + (org-ql-expect ((ts :to "2017-07-04" :type both)) + '("Skype with president of Antarctica")) + (org-ql-then + (org-ql-expect ((ts :to today)) + '("Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":to a number of days" - (org-ql-then - (org-ql-expect ((ts :to 5)) - '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-then + (org-ql-expect ((ts :to 5)) + '("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":on a timestamp" - (org-ql-expect ((ts :on "2017-07-05")) - '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :on "2017-07-05" :type both)) - '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) - (org-ql-expect ((ts :on "2019-06-09")) - nil) - (org-ql-expect ((ts :on "2019-06-09" :type both)) - nil) - (org-ql-then - (org-ql-expect ((ts :on today)) - '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) + (org-ql-expect ((ts :on "2017-07-05")) + '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :on "2017-07-05" :type both)) + '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")) + (org-ql-expect ((ts :on "2019-06-09")) + nil) + (org-ql-expect ((ts :on "2019-06-09" :type both)) + nil) + (org-ql-then + (org-ql-expect ((ts :on today)) + '("Practice leaping tall buildings in a single bound" "Learn universal sign language" "Order a pizza" "Get haircut" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp")))) (org-ql-it ":on a number of days" - (org-ql-then - (org-ql-expect ((ts :on 5)) - '("Renew membership in supervillain club")))))) + (org-ql-then + (org-ql-expect ((ts :on 5)) + '("Renew membership in supervillain club")))))) (describe "Compound queries" (org-ql-it "Tags and to-do" - (org-ql-expect ((and (todo "SOMEDAY") - (tags "Emacs"))) - '("Rewrite Emacs in Common Lisp")))))) + (org-ql-expect ((and (todo "SOMEDAY") + (tags "Emacs"))) + '("Rewrite Emacs in Common Lisp")))))) ;; Local Variables: ;; truncate-lines: t