neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 94f44d58fdd23f18b9e72195b36504c50a3e3de3
parent 4eebc46930008d7cf47491121556ee201e1f4860
Author: Rodrigodd <rodrigobatsmoraes@hotmail.com>
Date:   Sat, 28 Jun 2025 16:28:51 -0300

test(treesitter): test tree:root() is idempotent

Test for regression #34605

Diffstat:
Mtest/functional/treesitter/node_spec.lua | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/test/functional/treesitter/node_spec.lua b/test/functional/treesitter/node_spec.lua @@ -228,4 +228,17 @@ describe('treesitter node API', function() end) eq({ 0, 0, 2, 3 }, lua_eval('range')) 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)