From 7a00ca92c191a8d105283f73e9b68f6a0378a3a0 Mon Sep 17 00:00:00 2001 From: Denis Zubarev Date: Sun, 12 Nov 2023 01:42:42 +0300 Subject: [PATCH] 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). --- test/src/treesit-tests.el | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el index 9ba3a9340c1..1763c3894f5 100644 --- a/test/src/treesit-tests.el +++ b/test/src/treesit-tests.el @@ -1090,9 +1090,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")))) @@ -1104,10 +1107,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")))) -- 2.39.2