aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/fold_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/treesitter/fold_spec.lua')
-rw-r--r--test/functional/treesitter/fold_spec.lua40
1 files changed, 32 insertions, 8 deletions
diff --git a/test/functional/treesitter/fold_spec.lua b/test/functional/treesitter/fold_spec.lua
index 9428432f66..a7f278aa01 100644
--- a/test/functional/treesitter/fold_spec.lua
+++ b/test/functional/treesitter/fold_spec.lua
@@ -1,13 +1,15 @@
-local helpers = require('test.functional.helpers')(after_each)
-local clear = helpers.clear
-local eq = helpers.eq
-local insert = helpers.insert
-local exec_lua = helpers.exec_lua
-local command = helpers.command
-local feed = helpers.feed
-local poke_eventloop = helpers.poke_eventloop
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local clear = n.clear
+local eq = t.eq
+local insert = n.insert
+local exec_lua = n.exec_lua
+local command = n.command
+local feed = n.feed
+local poke_eventloop = n.poke_eventloop
+
before_each(clear)
describe('treesitter foldexpr', function()
@@ -404,6 +406,28 @@ t3]])
}, get_fold_levels())
end)
+ it('handles quantified patterns', function()
+ insert([[
+import hello
+import hello
+import hello
+import hello
+import hello
+import hello]])
+
+ exec_lua([[vim.treesitter.query.set('python', 'folds', '(import_statement)+ @fold')]])
+ parse('python')
+
+ eq({
+ [1] = '>1',
+ [2] = '1',
+ [3] = '1',
+ [4] = '1',
+ [5] = '1',
+ [6] = '1',
+ }, get_fold_levels())
+ end)
+
it('updates folds in all windows', function()
local screen = Screen.new(60, 48)
screen:attach()