test: improve editor/fold_spec.lua and editor/put_spec.lua (#22916)

- Close and open a new window each time so that window options have
  their default values in each test.
- Change feed_command() to command() as the latter is faster.
This commit is contained in:
zeertzjq
2023-04-07 09:29:12 +08:00
committed by GitHub
parent 7190dba017
commit 73060f00dd
3 changed files with 96 additions and 75 deletions

View File

@@ -4,7 +4,6 @@ local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq
local command = helpers.command
local feed_command = helpers.feed_command
local insert = helpers.insert
local expect = helpers.expect
local funcs = helpers.funcs
local meths = helpers.meths
local exec = helpers.exec
@@ -2023,29 +2022,4 @@ describe("folded lines", function()
describe('without ext_multigrid', function()
with_ext_multigrid(false)
end)
it('no folds remains if :delete makes buffer empty #19671', function()
funcs.setline(1, {'foo', 'bar', 'baz'})
command('2,3fold')
command('%delete')
eq(0, funcs.foldlevel(1))
end)
it('multibyte fold markers work #20438', function()
exec([[
setlocal foldmethod=marker
setlocal foldmarker=«,»
setlocal commentstring=/*%s*/
]])
insert([[
bbbbb
bbbbb
bbbbb]])
feed('zfgg')
expect([[
bbbbb/*«*/
bbbbb
bbbbb/*»*/]])
eq(1, funcs.foldlevel(1))
end)
end)