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")) (org-ql-expect ((tags* "frui"))
'("Fruit" "Blueberry" "Strawberry") '("Fruit" "Blueberry" "Strawberry")
:buffer (org-ql-test-data-buffer "data2.org")))) :buffer (org-ql-test-data-buffer "data2.org"))))
;;
;; (describe "(ts)" (describe "(ts)"
;;
;; (describe "active" (describe "active"
;;
;; (org-ql-it "without arguments" (org-ql-it "without arguments"
;; (org-ql-expect ((ts :type active)) (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"))) '("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-it ":from a timestamp"
;; (org-ql-expect ((ts :from "2017-07-08" :type active)) (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")) '("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)) (org-ql-expect ((ts :from "2019-06-08" :type active))
;; nil) nil)
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :from today)) (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")))) '("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-it ":from a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :from 5)) (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")))) '("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-it ":to a timestamp"
;; (org-ql-expect ((ts :to "2019-06-10" :type active)) (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")) '("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)) (org-ql-expect ((ts :to "2017-07-04" :type active))
;; '("Skype with president of Antarctica")) '("Skype with president of Antarctica"))
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :to today)) (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")))) '("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-it ":to a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :to -1)) (org-ql-expect ((ts :to -1))
;; '("Skype with president of Antarctica")))) '("Skype with president of Antarctica"))))
;;
;; (org-ql-it ":on a timestamp" (org-ql-it ":on a timestamp"
;; (org-ql-expect ((ts :on "2017-07-05" :type active)) (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")) '("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)) (org-ql-expect ((ts :on "2019-06-09" :type active))
;; nil) nil)
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :on today)) (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")))) '("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-it ":on a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts-active :on 2)) (org-ql-expect ((ts-active :on 2))
;; '("Take over the world"))))) '("Take over the world")))))
;;
;; (describe "inactive" (describe "inactive"
;;
;; (org-ql-it "without arguments" (org-ql-it "without arguments"
;; (org-ql-expect ((ts :type inactive)) (org-ql-expect ((ts :type inactive))
;; '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))) '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")))
;;
;; (org-ql-it ":from a timestamp" (org-ql-it ":from a timestamp"
;; (org-ql-expect ((ts :from "2017-07-06" :type inactive)) (org-ql-expect ((ts :from "2017-07-06" :type inactive))
;; '("Visit the moon" "Rewrite Emacs in Common Lisp")) '("Visit the moon" "Rewrite Emacs in Common Lisp"))
;; (org-ql-expect ((ts :from "2019-06-08" :type inactive)) (org-ql-expect ((ts :from "2019-06-08" :type inactive))
;; nil) nil)
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts-inactive :from today)) (org-ql-expect ((ts-inactive :from today))
;; '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")))) '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))))
;;
;; (org-ql-it ":from a number of days" (org-ql-it ":from a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts-i :from 5)) (org-ql-expect ((ts-i :from 5))
;; '("Visit the moon" "Rewrite Emacs in Common Lisp")))) '("Visit the moon" "Rewrite Emacs in Common Lisp"))))
;;
;; (org-ql-it ":to a timestamp" (org-ql-it ":to a timestamp"
;; (org-ql-expect ((ts :to "2019-06-10" :type inactive)) (org-ql-expect ((ts :to "2019-06-10" :type inactive))
;; '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp")) '("Visit the moon" "Learn universal sign language" "Rewrite Emacs in Common Lisp"))
;; (org-ql-expect ((ts :to "2017-07-04" :type inactive)) (org-ql-expect ((ts :to "2017-07-04" :type inactive))
;; 'nil) 'nil)
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts-inactive :to today)) (org-ql-expect ((ts-inactive :to today))
;; '("Learn universal sign language")))) '("Learn universal sign language"))))
;;
;; (org-ql-it ":to a number of days" (org-ql-it ":to a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts-i :to 5)) (org-ql-expect ((ts-i :to 5))
;; '("Learn universal sign language")))) '("Learn universal sign language"))))
;;
;; (org-ql-it ":on a timestamp" (org-ql-it ":on a timestamp"
;; (org-ql-expect ((ts :on "2017-07-05" :type inactive)) (org-ql-expect ((ts :on "2017-07-05" :type inactive))
;; '("Learn universal sign language")) '("Learn universal sign language"))
;; (org-ql-expect ((ts :on "2019-06-09" :type inactive)) (org-ql-expect ((ts :on "2019-06-09" :type inactive))
;; nil) nil)
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts-inactive :on today)) (org-ql-expect ((ts-inactive :on today))
;; '("Learn universal sign language")))) '("Learn universal sign language"))))
;;
;; (org-ql-it ":on a number of days" (org-ql-it ":on a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts-inactive :on 19)) (org-ql-expect ((ts-inactive :on 19))
;; '("Visit the moon" "Rewrite Emacs in Common Lisp"))))) '("Visit the moon" "Rewrite Emacs in Common Lisp")))))
;;
;; (describe "both" (describe "both"
;;
;; (org-ql-it "without arguments" (org-ql-it "without arguments"
;; (org-ql-expect ((ts)) (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")) '("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)) (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"))) '("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-it ":from a timestamp"
;; (org-ql-expect ((ts :from "2017-07-05")) (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")) '("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)) (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")) '("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")) (org-ql-expect ((ts :from "2019-06-08"))
;; nil) nil)
;; (org-ql-expect ((ts :from "2019-06-08" :type both)) (org-ql-expect ((ts :from "2019-06-08" :type both))
;; nil) nil)
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :from today)) (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")))) '("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-it ":from a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :from -5)) (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")))) '("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-it ":to a timestamp"
;; (org-ql-expect ((ts :to "2017-07-06")) (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")) '("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)) (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")) '("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")) (org-ql-expect ((ts :to "2017-07-04"))
;; '("Skype with president of Antarctica")) '("Skype with president of Antarctica"))
;; (org-ql-expect ((ts :to "2017-07-04" :type both)) (org-ql-expect ((ts :to "2017-07-04" :type both))
;; '("Skype with president of Antarctica")) '("Skype with president of Antarctica"))
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :to today)) (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")))) '("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-it ":to a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :to 5)) (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")))) '("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-it ":on a timestamp"
;; (org-ql-expect ((ts :on "2017-07-05")) (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")) '("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)) (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")) '("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")) (org-ql-expect ((ts :on "2019-06-09"))
;; nil) nil)
;; (org-ql-expect ((ts :on "2019-06-09" :type both)) (org-ql-expect ((ts :on "2019-06-09" :type both))
;; nil) nil)
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :on today)) (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")))) '("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-it ":on a number of days"
;; (org-ql-then (org-ql-then
;; (org-ql-expect ((ts :on 5)) (org-ql-expect ((ts :on 5))
;; '("Renew membership in supervillain club")))))) '("Renew membership in supervillain club"))))))
;;
;; (describe "Compound queries" (describe "Compound queries"
;;
;; (org-ql-it "Tags and to-do" (org-ql-it "Tags and to-do"
;; (org-ql-expect ((and (todo "SOMEDAY") (org-ql-expect ((and (todo "SOMEDAY")
;; (tags "Emacs"))) (tags "Emacs")))
;; '("Rewrite Emacs in Common Lisp")))) '("Rewrite Emacs in Common Lisp")))))
)
(describe "Org link safety" (describe "Org link safety"