Skip to content

Commit 699629e

Browse files
committed
add unit testing documentation for tags queries
1 parent 9866674 commit 699629e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/section-8-code-navigation-systems.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,20 @@ Invoking `tree-sitter tags test.rb` produces the following console output, repre
101101
```
102102

103103
It is expected that tag queries for a given language are located at `queries/tags.scm` in that language's repository.
104+
105+
## Unit Testing
106+
107+
Tags queries may be tested with `tree-sitter test`. Files under `test/tags/` are checked using the same comment system as [highlights queries](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#unit-testing). For example, the above Ruby tags can be tested with these comments:
108+
109+
```ruby
110+
module Foo
111+
# ^ definition.module
112+
class Bar
113+
# ^ definition.class
114+
115+
def baz
116+
# ^ definition.method
117+
end
118+
end
119+
end
120+
```

0 commit comments

Comments
 (0)