query: Handle #not-match? in rust, wasm bindings
This commit is contained in:
parent
32099050d6
commit
1ae5cbc851
4 changed files with 25 additions and 7 deletions
|
|
@ -126,12 +126,17 @@ describe("Query", () => {
|
|||
|
||||
it("handles conditions that compare the text of capture to literal strings", () => {
|
||||
tree = parser.parse(`
|
||||
lambda
|
||||
panda
|
||||
load
|
||||
toad
|
||||
const ab = require('./ab');
|
||||
new Cd(EF);
|
||||
`);
|
||||
|
||||
query = JavaScript.query(`
|
||||
(identifier) @variable
|
||||
((identifier) @variable
|
||||
(#not-match? @variable "^(lambda|load)$"))
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#eq? @function.builtin "require"))
|
||||
|
|
@ -145,6 +150,8 @@ describe("Query", () => {
|
|||
|
||||
const captures = query.captures(tree.rootNode);
|
||||
assert.deepEqual(formatCaptures(captures), [
|
||||
{ name: "variable", text: "panda" },
|
||||
{ name: "variable", text: "toad" },
|
||||
{ name: "variable", text: "ab" },
|
||||
{ name: "variable", text: "require" },
|
||||
{ name: "function.builtin", text: "require" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue