This commit is contained in:
Adam Porter 2020-11-22 11:11:59 -06:00
parent 78375ed958
commit b2073fb2b1

View file

@ -1004,174 +1004,173 @@ RESULTS should be a list of strings as returned by
(org-ql-expect ((tags* "frui"))
'("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-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-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-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-it ":to a number of days"
;; (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-it ":on a number of days"
;; (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-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-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-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-it ":to a number of days"
;; (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-it ":on a number of days"
;; (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-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-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-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-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-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-it ":on a number of days"
;; (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"))))
)
(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-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-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-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-it ":to a number of days"
(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-it ":on a number of days"
(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-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-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-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-it ":to a number of days"
(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-it ":on a number of days"
(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-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-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-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-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-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-it ":on a number of days"
(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")))))
(describe "Org link safety"