Fix treesit test (bug#67117)
* test/src/treesit-tests.el (treesit-search-subtree-forward-1): (treesit-search-subtree-backward-1): Replace treesit--thing-at with treesit-query-capture (treesit--thing-at isn't available in Emacs 29).
This commit is contained in:
parent
d220893216
commit
7a00ca92c1
1 changed files with 13 additions and 7 deletions
|
@ -1090,9 +1090,12 @@ This tests bug#60355."
|
||||||
(python-ts-mode)
|
(python-ts-mode)
|
||||||
(insert "Temp(1, 2)")
|
(insert "Temp(1, 2)")
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let ((node (treesit-search-subtree
|
(pcase-let* ((`((,_ . ,call-node))
|
||||||
(treesit--thing-at (point) "call")
|
(treesit-query-capture (treesit-buffer-root-node)
|
||||||
(lambda (n) (equal (treesit-node-type n ) "integer")))))
|
'((call) @c)))
|
||||||
|
(node (treesit-search-subtree
|
||||||
|
call-node
|
||||||
|
(lambda (n) (equal (treesit-node-type n) "integer")))))
|
||||||
|
|
||||||
(should node)
|
(should node)
|
||||||
(should (equal (treesit-node-text node) "1"))))
|
(should (equal (treesit-node-text node) "1"))))
|
||||||
|
@ -1104,10 +1107,13 @@ This tests bug#60355."
|
||||||
(python-ts-mode)
|
(python-ts-mode)
|
||||||
(insert "Temp(1, 2)")
|
(insert "Temp(1, 2)")
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let ((node (treesit-search-subtree
|
(pcase-let* ((`((,_ . ,call-node))
|
||||||
(treesit--thing-at (point) "call")
|
(treesit-query-capture (treesit-buffer-root-node)
|
||||||
(lambda (n) (equal (treesit-node-type n ) "integer"))
|
'((call) @c)))
|
||||||
t)))
|
(node (treesit-search-subtree
|
||||||
|
call-node
|
||||||
|
(lambda (n) (equal (treesit-node-type n) "integer"))
|
||||||
|
t)))
|
||||||
|
|
||||||
(should node)
|
(should node)
|
||||||
(should (equal (treesit-node-text node) "2"))))
|
(should (equal (treesit-node-text node) "2"))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue