mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
test(treesitter): test tree:root() is idempotent
Test for regression #34605
(cherry picked from commit 94f44d58fd
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
e732cbe36c
commit
37fb09c162
@@ -228,4 +228,17 @@ describe('treesitter node API', function()
|
|||||||
end)
|
end)
|
||||||
eq({ 0, 0, 2, 3 }, lua_eval('range'))
|
eq({ 0, 0, 2, 3 }, lua_eval('range'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('tree:root() is idempotent', function()
|
||||||
|
insert([[
|
||||||
|
function x()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
]])
|
||||||
|
exec_lua(function()
|
||||||
|
local tree = vim.treesitter.get_parser(0, 'lua'):parse()[1]
|
||||||
|
assert(tree:root() == tree:root())
|
||||||
|
assert(tree:root() == tree:root():tree():root())
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user