Fix: (heading) Don't match strings as regexps
Reported-by: Alex Popescu <https://github.com/al3xandru>
This commit is contained in:
parent
770e60766a
commit
b6efba9aeb
4 changed files with 61 additions and 73 deletions
|
|
@ -218,7 +218,8 @@ with keyword arg NOW in PLIST."
|
|||
(it "coalesces a single AND clause that uses two predicates (and preserves predicate order)"
|
||||
(expect (org-ql--normalize-query '(and (rifle "foo") (rifle "bar")
|
||||
(heading "baz") (heading "buz")))
|
||||
:to-equal '(and (rifle :regexps '("foo" "bar")) (heading "baz" "buz"))))
|
||||
;; NOTE: `heading' is normalized to `heading-regexp'.
|
||||
:to-equal '(and (rifle :regexps '("foo" "bar")) (heading-regexp "baz" "buz"))))
|
||||
(it "preserves independent OR clauses"
|
||||
(expect (org-ql--normalize-query '(and (or (rifle "foo") (rifle "bar"))
|
||||
(or (rifle "baz") (rifle "buz"))))
|
||||
|
|
@ -1112,7 +1113,12 @@ with keyword arg NOW in PLIST."
|
|||
'("Take over the world")))
|
||||
(org-ql-it "with two arguments"
|
||||
(org-ql-expect ('(heading "Take over" "world"))
|
||||
'("Take over the world"))))
|
||||
'("Take over the world")))
|
||||
(org-ql-it "does not match strings as regexps"
|
||||
(org-ql-expect ('(heading "over"))
|
||||
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon"))
|
||||
(org-ql-expect ('(heading "[over]"))
|
||||
nil)))
|
||||
|
||||
(describe "(heading-regexp)"
|
||||
(org-ql-it "with one argument"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue