Fix: (org-ql-regexp-part-ts-date) Allow punctuation in day-of-week

Fixes <https://github.com/alphapapa/org-ql/issues/432>.  Closes
<https://github.com/alphapapa/org-ql/pull/435>.

Reported-by: Florian D. <https://github.com/neurolit>
This commit is contained in:
Adam Porter 2024-06-26 10:52:31 -05:00
parent 914e64746f
commit ffc3477013
5 changed files with 76 additions and 52 deletions

View file

@ -17,6 +17,12 @@ DEADLINE: <2024-06-25 Tue 08:00-09:00 ++7d>
** Multi-timestamp, without repeater
<2024-06-25 Tue 08:00>--<2024-06-26 Wed 08:00>
* Day-of-week abbreviations
** French
<2024-07-12 Fri>
* Canary
/This entry should never be matched./

View file

@ -1700,16 +1700,16 @@ with keyword arg NOW in PLIST."
(1- (cl-loop while (re-search-forward org-heading-regexp nil t)
sum 1))))))
(org-ql-it "without specified timestamp"
(org-ql-it "without :with-time"
(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" "French")))
(org-ql-it ":with-time t"
(org-ql-expect ('(ts-active :on "2024-06-25" :with-time t))
'("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater"))
(org-ql-expect ('(ts-active :on "2024-06-26"))
(org-ql-expect ('(ts-active :on "2024-06-26" :with-time t))
'("Multi-timestamp, without repeater")))
(org-ql-it "with specified time values"
(org-ql-expect ('(ts-active :to "2024-06-25 09:00"))
(org-ql-it ":with-time t and with specified time value in :to"
(org-ql-expect ('(ts-active :to "2024-06-25 09:00" :with-time t))
'("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
@ -1856,7 +1856,20 @@ with keyword arg NOW in PLIST."
'("Visit Mars")))
(org-ql-then (:now "2019-07-07")
(org-ql-expect ('(ts :on today))
nil)))))
nil))))
(describe "Day-of-week abbreviations"
(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 "matches French abbreviations (with trailing period)"
(org-ql-expect ('(ts :on "2024-07-12"))
'("French")))))
(describe "Compound queries"