]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix treesit test (bug#67117)
authorDenis Zubarev <dvzubarev@yandex.ru>
Sat, 11 Nov 2023 22:42:42 +0000 (01:42 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 23 Dec 2023 13:18:10 +0000 (14:18 +0100)
* 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).

(cherry picked from commit 7a00ca92c191a8d105283f73e9b68f6a0378a3a0)

test/src/treesit-tests.el

index c9b15c618c1bb780b053612460d5250e1a97898a..e5f3a5d992e85bbc055a69a5b9e60e7bad125333 100644 (file)
@@ -1174,9 +1174,12 @@ This tests bug#60355."
   (python-ts-mode)
   (insert "Temp(1, 2)")
   (goto-char (point-min))
-  (let ((node (treesit-search-subtree
-               (treesit--thing-at (point) "call")
-               (lambda (n) (equal (treesit-node-type n ) "integer")))))
+  (pcase-let* ((`((,_ . ,call-node))
+                (treesit-query-capture (treesit-buffer-root-node)
+                                       '((call) @c)))
+               (node (treesit-search-subtree
+                      call-node
+                      (lambda (n) (equal (treesit-node-type n) "integer")))))
 
     (should node)
     (should (equal (treesit-node-text node) "1"))))
@@ -1188,10 +1191,13 @@ This tests bug#60355."
   (python-ts-mode)
   (insert "Temp(1, 2)")
   (goto-char (point-min))
-  (let ((node (treesit-search-subtree
-               (treesit--thing-at (point) "call")
-               (lambda (n) (equal (treesit-node-type n ) "integer"))
-               t)))
+  (pcase-let* ((`((,_ . ,call-node))
+                (treesit-query-capture (treesit-buffer-root-node)
+                                       '((call) @c)))
+               (node (treesit-search-subtree
+                      call-node
+                      (lambda (n) (equal (treesit-node-type n) "integer"))
+                      t)))
 
     (should node)
     (should (equal (treesit-node-text node) "2"))))