diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/treesitter/node_spec.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/treesitter/node_spec.lua b/test/functional/treesitter/node_spec.lua index 96579f296b..6270ea3aa1 100644 --- a/test/functional/treesitter/node_spec.lua +++ b/test/functional/treesitter/node_spec.lua @@ -55,6 +55,23 @@ describe('treesitter node API', function() eq('identifier', lua_eval('node:type()')) end) + it('get_node() with anonymous nodes included', function() + insert([[print('test')]]) + + exec_lua([[ + parser = vim.treesitter.get_parser(0, 'lua') + tree = parser:parse()[1] + node = vim.treesitter.get_node({ + bufnr = 0, + pos = { 0, 6 }, -- on the first apostrophe + include_anonymous = true, + }) + ]]) + + eq("'", lua_eval('node:type()')) + eq(false, lua_eval('node:named()')) + end) + it('can move between siblings', function() insert([[ int main(int x, int y, int z) { |