aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/parser_spec.lua
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-04-08 11:03:20 +0200
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-04-08 22:51:00 +0200
commit7035125b2b26aa68fcfb7cda39377ac79926a0f9 (patch)
treed194a3556a367b42505f9e7d26637e7cb3674928 /test/functional/treesitter/parser_spec.lua
parent978962f9a00ce75216d2c36b79397ef3d2b54096 (diff)
downloadrneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.gz
rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.bz2
rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.zip
test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
Diffstat (limited to 'test/functional/treesitter/parser_spec.lua')
-rw-r--r--test/functional/treesitter/parser_spec.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index 5af53202a6..8b2d1fd4aa 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -1,12 +1,12 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.functional.testutil')(after_each)
-local clear = helpers.clear
-local dedent = helpers.dedent
-local eq = helpers.eq
-local insert = helpers.insert
-local exec_lua = helpers.exec_lua
-local pcall_err = helpers.pcall_err
-local feed = helpers.feed
+local clear = t.clear
+local dedent = t.dedent
+local eq = t.eq
+local insert = t.insert
+local exec_lua = t.exec_lua
+local pcall_err = t.pcall_err
+local feed = t.feed
describe('treesitter parser API', function()
before_each(function()
@@ -381,7 +381,7 @@ int x = INT_MAX;
{ 2, 29, 2, 66 }, -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- helpers.feed('ggo<esc>')
+ t.feed('ggo<esc>')
eq(5, exec_lua('return #parser:children().c:trees()'))
eq({
{ 0, 0, 8, 0 }, -- root tree
@@ -418,7 +418,7 @@ int x = INT_MAX;
-- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- helpers.feed('ggo<esc>')
+ t.feed('ggo<esc>')
eq('table', exec_lua('return type(parser:children().c)'))
eq(2, exec_lua('return #parser:children().c:trees()'))
eq({
@@ -430,7 +430,7 @@ int x = INT_MAX;
-- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- helpers.feed('7ggI//<esc>')
+ t.feed('7ggI//<esc>')
exec_lua([[parser:parse({6, 7})]])
eq('table', exec_lua('return type(parser:children().c)'))
eq(2, exec_lua('return #parser:children().c:trees()'))
@@ -468,7 +468,7 @@ int x = INT_MAX;
{ 2, 29, 2, 66 }, -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- helpers.feed('ggo<esc>')
+ t.feed('ggo<esc>')
eq(5, exec_lua('return #parser:children().c:trees()'))
eq({
{ 0, 0, 8, 0 }, -- root tree
@@ -657,7 +657,7 @@ int x = INT_MAX;
{ 'declaration', 1, 2, 1, 12 },
}, run_query())
- helpers.command 'normal ggO'
+ t.command 'normal ggO'
insert('int a;')
eq({