Fix: (--value-at) Clear value cache when buffer changes
Fixes #59. Thanks to Daniel Hubmann (@hubisan) for reporting.
This commit is contained in:
parent
02159a831a
commit
a1851ed0eb
2 changed files with 21 additions and 1 deletions
|
|
@ -142,6 +142,25 @@ RESULTS should be a list of strings as returned by
|
|||
(cl-loop while (re-search-forward org-heading-regexp nil t)
|
||||
sum 1)))))
|
||||
|
||||
(describe "Caching"
|
||||
(it "Clears value cache after buffer changes"
|
||||
;; See <https://github.com/alphapapa/org-ql/issues/59>.
|
||||
(with-temp-buffer
|
||||
(org-mode)
|
||||
(insert "* Heading 1
|
||||
* Heading 2")
|
||||
;; FIXME: `--value-at' does not actually move point, so we do it here.
|
||||
(goto-char (point-min))
|
||||
(expect (org-ql--value-at (point-min) #'org-get-heading)
|
||||
:to-equal "Heading 1")
|
||||
(erase-buffer)
|
||||
;; FIXME: See above.
|
||||
(insert "* Heading 2")
|
||||
(goto-char (point-min))
|
||||
(org-ql--value-at (point-min) #'point)
|
||||
(expect (org-ql--value-at (point-min) #'org-get-heading)
|
||||
:to-equal "Heading 2"))))
|
||||
|
||||
(describe "Query functions/macros"
|
||||
|
||||
(it "org-ql"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue