vim-patch:8.2.2684: not enough folding code is tested

Problem:    Not enough folding code is tested.
Solution:   Add more test cases. (Yegappan Lakshmanan, closes vim/vim#8046)

5c504f680e

Reorder test_fold.vim to match upstream.
Cherry-pick Test_fold_expr_error() from patch 8.2.0633.
Cherry-pick syntax feature check from patch 8.2.1432.
Cherry-pick a delete() call from patch 8.2.2112.
This commit is contained in:
zeertzjq
2022-11-25 15:07:25 +08:00
parent 2738f842f6
commit ba360a26a2
6 changed files with 441 additions and 99 deletions

View File

@@ -7,7 +7,7 @@ local insert = helpers.insert
local expect = helpers.expect
local funcs = helpers.funcs
local meths = helpers.meths
local source = helpers.source
local exec = helpers.exec
local assert_alive = helpers.assert_alive
@@ -199,50 +199,6 @@ describe("folded lines", function()
end
end)
it("highlighting with relative line numbers", function()
command("set relativenumber cursorline cursorlineopt=number foldmethod=marker")
feed_command("set foldcolumn=2")
funcs.setline(1, '{{{1')
funcs.setline(2, 'line 1')
funcs.setline(3, '{{{1')
funcs.setline(4, 'line 2')
feed("j")
if multigrid then
screen:expect([[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
{7:+ }{8: 1 }{5:+-- 2 lines: ·························}|
{7:+ }{9: 0 }{5:^+-- 2 lines: ·························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
:set foldcolumn=2 |
]])
else
screen:expect([[
{7:+ }{8: 1 }{5:+-- 2 lines: ·························}|
{7:+ }{9: 0 }{5:^+-- 2 lines: ·························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
:set foldcolumn=2 |
]])
end
end)
it("work with spell", function()
command("set spell")
insert(content1)
@@ -1714,7 +1670,7 @@ describe("folded lines", function()
end)
it('does not crash when foldtext is longer than columns #12988', function()
source([[
exec([[
function! MyFoldText() abort
return repeat('-', &columns + 100)
endfunction
@@ -1761,7 +1717,7 @@ describe("folded lines", function()
it('work correctly with :move #18668', function()
screen:try_resize(45, 12)
source([[
exec([[
set foldmethod=expr foldexpr=indent(v:lnum)
let content = ['', '', 'Line1', ' Line2', ' Line3',
\ 'Line4', ' Line5', ' Line6',