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:
Denis Zubarev 2023-11-12 01:42:42 +03:00 committed by Yuan Fu
parent d220893216
commit 7a00ca92c1
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -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"))))