Tests: Timestamps with inner time ranges
This commit is contained in:
parent
0d9c46247d
commit
02b4213826
2 changed files with 53 additions and 1 deletions
23
tests/data-ts.org
Normal file
23
tests/data-ts.org
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#+title: Timestamp-specific tests
|
||||||
|
|
||||||
|
/Timestamps in this file are active ones./
|
||||||
|
|
||||||
|
* Single-timestamp ranges
|
||||||
|
|
||||||
|
** Single-timestamp, without repeater
|
||||||
|
<2024-06-25 Tue 08:00-09:00>
|
||||||
|
|
||||||
|
** Single-timestamp, with repeater (deadline)
|
||||||
|
DEADLINE: <2024-06-25 Tue 08:00-09:00 ++7d>
|
||||||
|
|
||||||
|
* Multi-timestamp ranges
|
||||||
|
|
||||||
|
/Not sure that it would make sense to use repeaters for this kind of range./
|
||||||
|
|
||||||
|
** Multi-timestamp, without repeater
|
||||||
|
<2024-06-25 Tue 08:00>--<2024-06-26 Wed 08:00>
|
||||||
|
|
||||||
|
* Canary
|
||||||
|
|
||||||
|
/This entry should never be matched./
|
||||||
|
|
||||||
|
|
@ -1688,7 +1688,36 @@ with keyword arg NOW in PLIST."
|
||||||
(org-ql-expect ((org-ql--query-string-to-sexp "ts-active:with-time="))
|
(org-ql-expect ((org-ql--query-string-to-sexp "ts-active:with-time="))
|
||||||
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "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" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
|
||||||
(org-ql-expect ((org-ql--query-string-to-sexp "ts-active:with-time=t"))
|
(org-ql-expect ((org-ql--query-string-to-sexp "ts-active:with-time=t"))
|
||||||
'("Skype with president of Antarctica" "Renew membership in supervillain club" "Order a pizza"))))
|
'("Skype with president of Antarctica" "Renew membership in supervillain club" "Order a pizza")))
|
||||||
|
|
||||||
|
(describe "matches timestamps with inner time ranges"
|
||||||
|
(before-each
|
||||||
|
(setq org-ql-test-buffer (org-ql-test-data-buffer "data-ts.org")
|
||||||
|
org-ql-test-num-headings (with-current-buffer org-ql-test-buffer
|
||||||
|
(org-with-wide-buffer
|
||||||
|
(goto-char (point-min))
|
||||||
|
;; Exclude the "Canary" heading.
|
||||||
|
(1- (cl-loop while (re-search-forward org-heading-regexp nil t)
|
||||||
|
sum 1))))))
|
||||||
|
|
||||||
|
(org-ql-it "without specified timestamp"
|
||||||
|
(org-ql-expect ('(ts-active))
|
||||||
|
'("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater")))
|
||||||
|
(org-ql-it "with specified timestamps"
|
||||||
|
(org-ql-expect ('(ts-active :on "2024-06-25"))
|
||||||
|
'("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater"))
|
||||||
|
(org-ql-expect ('(ts-active :on "2024-06-26"))
|
||||||
|
'("Multi-timestamp, without repeater")))
|
||||||
|
(org-ql-it "with specified time values"
|
||||||
|
(org-ql-expect ('(ts-active :to "2024-06-25 09:00"))
|
||||||
|
'("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater"))
|
||||||
|
;; FIXME: The test below fails because timestamps with
|
||||||
|
;; ranges are not yet parsed into multiple timestamps and
|
||||||
|
;; compared as a range. This will have to be addressed in
|
||||||
|
;; a new version.
|
||||||
|
;; (org-ql-expect ('(ts-active :from "2024-06-25 08:30"))
|
||||||
|
;; '("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater"))
|
||||||
|
)))
|
||||||
|
|
||||||
(describe "inactive"
|
(describe "inactive"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue