Tests: Use org-ql-it in more tests

This commit is contained in:
Adam Porter 2019-07-24 20:20:04 -05:00
parent 3a9b32002e
commit 290e25509b

View file

@ -351,12 +351,12 @@ Based on Buttercup macro `it'."
:to-equal '("Learn universal sign language"))) :to-equal '("Learn universal sign language")))
(describe "(regexp)" (describe "(regexp)"
(it "with 1 argument" (org-ql-it "with 1 argument"
(expect (org-ql test-buffer (expect (org-ql test-buffer
(regexp "Take over") (regexp "Take over")
:sort todo :sort todo
:action (org-ql-test-org-get-heading)) :to-equal '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))) :action (org-ql-test-org-get-heading)) :to-equal '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))
(it "with 2 arguments" (org-ql-it "with 2 arguments"
(expect (org-ql test-buffer (expect (org-ql test-buffer
(regexp "Take over" "pizza") (regexp "Take over" "pizza")
:sort todo :sort todo
@ -376,31 +376,31 @@ Based on Buttercup macro `it'."
:to-equal '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Order a pizza" "Get haircut")))) :to-equal '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Order a pizza" "Get haircut"))))
(describe "(todo)" (describe "(todo)"
(it "without arguments" (org-ql-it "without arguments"
;; FIXME: This returns an item that is done, which is incorrect. ;; FIXME: This returns an item that is done, which is incorrect.
(expect (org-ql test-buffer (expect (org-ql test-buffer
(todo) (todo)
:sort todo :sort todo
:action (org-ql-test-org-get-heading)) :to-equal '("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"))) :action (org-ql-test-org-get-heading)) :to-equal '("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")))
(it "with 1 argument" (org-ql-it "with 1 argument"
;; FIXME: Figure out why this takes >10x longer than the other (todo) tests, according to Buttercup. ;; FIXME: Figure out why this takes >10x longer than the other (todo) tests, according to Buttercup.
(expect (org-ql test-buffer (expect (org-ql test-buffer
(todo "WAITING") (todo "WAITING")
:sort todo :sort todo
:action (org-ql-test-org-get-heading)) :to-equal '("Visit the moon"))) :action (org-ql-test-org-get-heading)) :to-equal '("Visit the moon")))
(it "with 2 arguments" (org-ql-it "with 2 arguments"
(expect (org-ql test-buffer (expect (org-ql test-buffer
(todo "WAITING" "SOMEDAY") (todo "WAITING" "SOMEDAY")
:sort todo :sort todo
:action (org-ql-test-org-get-heading)) :to-equal '("Visit the moon" "Rewrite Emacs in Common Lisp" "Write a symphony")))) :action (org-ql-test-org-get-heading)) :to-equal '("Visit the moon" "Rewrite Emacs in Common Lisp" "Write a symphony"))))
(describe "(ts)" (describe "(ts)"
(it "without arguments" (org-ql-it "without arguments"
(expect (org-ql test-buffer (expect (org-ql test-buffer
(ts) (ts)
:action (org-ql-test-org-get-heading)) :action (org-ql-test-org-get-heading))
:to-equal '("Test data" "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"))) :to-equal '("Test data" "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")))
(it ":from a timestamp" (org-ql-it ":from a timestamp"
;; TODO: Figure out why these take longer than the other (ts) tests. ;; TODO: Figure out why these take longer than the other (ts) tests.
(expect (org-ql test-buffer (expect (org-ql test-buffer
(ts :from "2017-01-01") (ts :from "2017-01-01")