From 93f40d1bb7ab12d971e87ac2786135487d2ee4ed Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 5 Apr 2026 09:52:56 +0300 Subject: [PATCH] ; Fix recently-added treesit test * test/src/treesit-tests.el (treesit-query-node-only-and-grouped): Remove unused variables. --- test/src/treesit-tests.el | 46 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el index 58579e82f7d..dfbb4124a5f 100644 --- a/test/src/treesit-tests.el +++ b/test/src/treesit-tests.el @@ -594,33 +594,31 @@ BODY is the test body." "Tests for query API." (skip-unless (treesit-language-available-p 'json)) (with-temp-buffer - (let (parser root-node) - (progn - (insert "[1,2,{\"name\": \"Bob\"},3]") - (setq parser (treesit-parser-create 'json))) + (insert "[1,2,{\"name\": \"Bob\"},3]") + (treesit-parser-create 'json) - ;; Test NODE-ONLY. - (let ((res (treesit-query-capture 'json '((number) @num) nil nil t))) - (should (equal (length res) 3)) - ;; First element should be a node rather than 'num. - (should (treesit-node-p (nth 0 res)))) + ;; Test NODE-ONLY. + (let ((res (treesit-query-capture 'json '((number) @num) nil nil t))) + (should (equal (length res) 3)) + ;; First element should be a node rather than 'num. + (should (treesit-node-p (nth 0 res)))) - ;; Test GROUPED. - (let ((res (treesit-query-capture 'json '((number) @num) nil nil nil t))) - (should (equal (length res) 3)) - ;; First element should be a match group. - (should (consp (nth 0 res))) - ;; First element of the match group should be a cons (num . ). - (should (consp (nth 0 (nth 0 res)))) - (should (eq (car (nth 0 (nth 0 res))) 'num))) + ;; Test GROUPED. + (let ((res (treesit-query-capture 'json '((number) @num) nil nil nil t))) + (should (equal (length res) 3)) + ;; First element should be a match group. + (should (consp (nth 0 res))) + ;; First element of the match group should be a cons (num . ). + (should (consp (nth 0 (nth 0 res)))) + (should (eq (car (nth 0 (nth 0 res))) 'num))) - ;; Test NODE-ONLY + GROUPED. - (let ((res (treesit-query-capture 'json '((number) @num) nil nil t t))) - (should (equal (length res) 3)) - ;; First element should be a match group. - (should (consp (nth 0 res))) - ;; First element of the match group should be a node. - (should (treesit-node-p (nth 0 (nth 0 res)))))))) + ;; Test NODE-ONLY + GROUPED. + (let ((res (treesit-query-capture 'json '((number) @num) nil nil t t))) + (should (equal (length res) 3)) + ;; First element should be a match group. + (should (consp (nth 0 res))) + ;; First element of the match group should be a node. + (should (treesit-node-p (nth 0 (nth 0 res))))))) ;;; Narrow