aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/treesitter/node_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/treesitter/node_spec.lua b/test/functional/treesitter/node_spec.lua
index eef75d0e91..16ead69649 100644
--- a/test/functional/treesitter/node_spec.lua
+++ b/test/functional/treesitter/node_spec.lua
@@ -40,6 +40,20 @@ describe('treesitter node API', function()
assert_alive()
end)
+ it('get_node() with lang given', function()
+ -- this buffer doesn't have filetype set!
+ insert('local foo = function() end')
+ exec_lua([[
+ node = vim.treesitter.get_node({
+ bufnr = 0,
+ pos = { 0, 6 }, -- on "foo"
+ lang = 'lua',
+ })
+ ]])
+ eq('foo', lua_eval('vim.treesitter.query.get_node_text(node, 0)'))
+ eq('identifier', lua_eval('node:type()'))
+ end)
+
it('can move between siblings', function()
insert([[
int main(int x, int y, int z) {