diff options
author | Rom Grk <romgrk.cc@gmail.com> | 2020-11-03 03:11:08 -0500 |
---|---|---|
committer | Rom Grk <romgrk.cc@gmail.com> | 2020-11-03 03:11:08 -0500 |
commit | 13e0ca3e194a438383b8451e19090355aa6c29dc (patch) | |
tree | 0ac33ef5ac829b7c74dd15f34b17540c3186c356 /test/functional/lua/treesitter_spec.lua | |
parent | c7c865214655f7d88fde85ed4947f07319c14182 (diff) | |
parent | 5b5848f2fb1f4b7995bb8a59d94b6766d2182070 (diff) | |
download | rneovim-13e0ca3e194a438383b8451e19090355aa6c29dc.tar.gz rneovim-13e0ca3e194a438383b8451e19090355aa6c29dc.tar.bz2 rneovim-13e0ca3e194a438383b8451e19090355aa6c29dc.zip |
Merge branch 'master' into add-scroll-events
Diffstat (limited to 'test/functional/lua/treesitter_spec.lua')
-rw-r--r-- | test/functional/lua/treesitter_spec.lua | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/functional/lua/treesitter_spec.lua b/test/functional/lua/treesitter_spec.lua index 3526b64395..9eb5c8b1dd 100644 --- a/test/functional/lua/treesitter_spec.lua +++ b/test/functional/lua/treesitter_spec.lua @@ -80,13 +80,6 @@ describe('treesitter API with C parser', function() eq({1,2,1,12}, exec_lua("return {descendant:range()}")) eq("(declaration type: (primitive_type) declarator: (init_declarator declarator: (identifier) value: (number_literal)))", exec_lua("return descendant:sexpr()")) - eq(true, exec_lua("return child == child")) - -- separate lua object, but represents same node - eq(true, exec_lua("return child == root:child(0)")) - eq(false, exec_lua("return child == descendant2")) - eq(false, exec_lua("return child == nil")) - eq(false, exec_lua("return child == tree")) - feed("2G7|ay") exec_lua([[ tree2 = parser:parse() @@ -98,6 +91,21 @@ describe('treesitter API with C parser', function() eq("<node declaration>", exec_lua("return tostring(descendant2)")) eq({1,2,1,13}, exec_lua("return {descendant2:range()}")) + eq(true, exec_lua("return child == child")) + -- separate lua object, but represents same node + eq(true, exec_lua("return child == root:child(0)")) + eq(false, exec_lua("return child == descendant2")) + eq(false, exec_lua("return child == nil")) + eq(false, exec_lua("return child == tree")) + + eq("string", exec_lua("return type(child:id())")) + eq(true, exec_lua("return child:id() == child:id()")) + -- separate lua object, but represents same node + eq(true, exec_lua("return child:id() == root:child(0):id()")) + eq(false, exec_lua("return child:id() == descendant2:id()")) + eq(false, exec_lua("return child:id() == nil")) + eq(false, exec_lua("return child:id() == tree")) + -- orginal tree did not change eq({1,2,1,12}, exec_lua("return {descendant:range()}")) |