summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2023-04-13 18:45:07 -0700
committerYuan Fu <casouri@gmail.com>2023-04-13 18:47:41 -0700
commitde34de3b35cbe1da6fb035b93081e0564b3c7b3f (patch)
tree58da547b9fcfd362eb252c35c024cc6298a4db7e /test
parent3ef54c64fa8e7236458228db09fe7192350cbeb6 (diff)
downloademacs-de34de3b35cbe1da6fb035b93081e0564b3c7b3f.tar.gz
Fix previous commit on tree-sitter
* src/treesit.c: (treesit_traverse_validate_predicate): Don't accept symbols. (treesit_traverse_match_predicate): Don't accept symbols, and use correct variable for the regexp and pred check. * test/src/treesit-tests.el: (treesit-search-forward-predicate): Fix the test.
Diffstat (limited to 'test')
-rw-r--r--test/src/treesit-tests.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el
index 26a21c34152..34f9f15beaa 100644
--- a/test/src/treesit-tests.el
+++ b/test/src/treesit-tests.el
@@ -363,11 +363,12 @@ BODY is the test body."
while cursor
do (should (equal (treesit-node-text cursor) text)))
;; Test (regexp . function)
- (cl-labels ((is-odd (string)
- (and (eq 1 (length string))
- (cl-oddp (string-to-number string)))))
+ (let ((is-odd (lambda (node)
+ (let ((string (treesit-node-text node)))
+ (and (eq 1 (length string))
+ (cl-oddp (string-to-number string)))))))
(cl-loop for cursor = (treesit-node-child array 0)
- then (treesit-search-forward cursor '("number" . is-odd)
+ then (treesit-search-forward cursor `("number" . ,is-odd)
nil t)
for text in '("[" "1" "3" "5" "7" "9")
while cursor