summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2026-04-05 09:52:56 +0300
committerEli Zaretskii <eliz@gnu.org>2026-04-05 09:52:56 +0300
commit93f40d1bb7ab12d971e87ac2786135487d2ee4ed (patch)
treefb1468a49ea0042ab7bfab105f1947ef6b25b0eb /test
parent670bb34d91179eef087b6964edb445244180e8f6 (diff)
; Fix recently-added treesit test
* test/src/treesit-tests.el (treesit-query-node-only-and-grouped): Remove unused variables.
Diffstat (limited to 'test')
-rw-r--r--test/src/treesit-tests.el46
1 files 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 . <node>).
- (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 . <node>).
+ (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