mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
test: avoid repeated screen lines in expected states
This is the command invoked repeatedly to make the changes:
:%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
This commit is contained in:
@@ -30,19 +30,9 @@ describe('screen', function()
|
||||
end)
|
||||
|
||||
it('default initial screen', function()
|
||||
screen:expect([[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
{1:[No Name] }|
|
||||
|
|
||||
]])
|
||||
@@ -125,17 +115,7 @@ local function screen_tests(linegrid)
|
||||
command('set laststatus=2')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
{1:[No Name] }|
|
||||
|
|
||||
]])
|
||||
@@ -143,17 +123,7 @@ local function screen_tests(linegrid)
|
||||
feed('<c-l>')
|
||||
screen:expect{grid=[[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
{1:[No Name] }|
|
||||
|
|
||||
]], reset=true}
|
||||
@@ -161,17 +131,10 @@ local function screen_tests(linegrid)
|
||||
command('split')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*5
|
||||
{1:[No Name] }|
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*4
|
||||
{3:[No Name] }|
|
||||
|
|
||||
]])
|
||||
@@ -179,17 +142,10 @@ local function screen_tests(linegrid)
|
||||
feed('<c-l>')
|
||||
screen:expect{grid=[[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*5
|
||||
{1:[No Name] }|
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*4
|
||||
{3:[No Name] }|
|
||||
|
|
||||
]], reset=true}
|
||||
@@ -202,17 +158,10 @@ local function screen_tests(linegrid)
|
||||
command('sp')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*5
|
||||
{1:[No Name] }|
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*4
|
||||
{3:[No Name] }|
|
||||
|
|
||||
]])
|
||||
@@ -223,17 +172,10 @@ local function screen_tests(linegrid)
|
||||
command('resize 8')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*7
|
||||
{1:[No Name] }|
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*2
|
||||
{3:[No Name] }|
|
||||
|
|
||||
]])
|
||||
@@ -245,34 +187,20 @@ local function screen_tests(linegrid)
|
||||
command('vsp')
|
||||
screen:expect([[
|
||||
^ │ │ |
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|*5
|
||||
{1:[No Name] }{3:[No Name] [No Name] }|
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*4
|
||||
{3:[No Name] }|
|
||||
|
|
||||
]])
|
||||
insert('hello')
|
||||
screen:expect([[
|
||||
hell^o │hello │hello |
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|*5
|
||||
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
||||
hello |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*4
|
||||
{3:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
@@ -288,17 +216,10 @@ local function screen_tests(linegrid)
|
||||
insert('hello')
|
||||
screen:expect([[
|
||||
hell^o │hello │hello |
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|*5
|
||||
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
||||
hello |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*4
|
||||
{3:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
@@ -308,33 +229,17 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{4: }{5:4}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
|
||||
hell^o2 |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
|
|
||||
]])
|
||||
command('tabprevious')
|
||||
screen:expect([[
|
||||
{2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
|
||||
hell^o │hello │hello |
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|
|
||||
{0:~ }│{0:~ }│{0:~ }|*5
|
||||
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
||||
hello |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*3
|
||||
{3:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
@@ -345,34 +250,14 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{4: [No Name] }{2: [No Name] }{3: }{4:X}|
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
|
|
||||
]])
|
||||
|
||||
feed(':echo "'..string.rep('x\\n', 11)..'"<cr>')
|
||||
screen:expect([[
|
||||
{1: }|
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |*11
|
||||
|
|
||||
{7:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
@@ -381,34 +266,13 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{4: [No Name] }{2: [No Name] }{3: }{4:X}|
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
|
|
||||
]])
|
||||
|
||||
feed(':echo "'..string.rep('x\\n', 12)..'"<cr>')
|
||||
screen:expect([[
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |
|
||||
x |*12
|
||||
|
|
||||
{7:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
@@ -417,17 +281,7 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{4: [No Name] }{2: [No Name] }{3: }{4:X}|
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
|
|
||||
]])
|
||||
|
||||
@@ -439,17 +293,7 @@ local function screen_tests(linegrid)
|
||||
command('vsplit')
|
||||
screen:expect([[
|
||||
^foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |*11
|
||||
{1:[No Name] [+] }{3:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
@@ -457,17 +301,8 @@ local function screen_tests(linegrid)
|
||||
feed('<PageDown>')
|
||||
screen:expect([[
|
||||
^foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
foo │foo |
|
||||
bar │foo |
|
||||
bar │foo |
|
||||
bar │foo |
|
||||
bar │foo |
|
||||
bar │foo |
|
||||
bar │foo |
|
||||
bar │foo |
|
||||
bar │foo |
|
||||
foo │foo |*3
|
||||
bar │foo |*8
|
||||
{1:[No Name] [+] }{3:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
@@ -475,17 +310,8 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{4: }{5:2}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
|
||||
^foo |
|
||||
foo |
|
||||
foo |
|
||||
foo |
|
||||
bar |
|
||||
bar |
|
||||
bar |
|
||||
bar |
|
||||
bar |
|
||||
bar |
|
||||
bar |
|
||||
bar |
|
||||
foo |*3
|
||||
bar |*8
|
||||
|
|
||||
]])
|
||||
end)
|
||||
@@ -497,17 +323,7 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{2: + [No Name] }{4: [No Name] }{3: }{4:X}|
|
||||
hell^o |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
|
|
||||
]])
|
||||
|
||||
@@ -515,17 +331,7 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{4: + [No Name] }{2: [No Name] }{3: }{4:X}|
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
|
|
||||
]])
|
||||
end)
|
||||
@@ -538,16 +344,7 @@ local function screen_tests(linegrid)
|
||||
line 1 |
|
||||
line 2 |
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*10
|
||||
{2:-- INSERT --} |
|
||||
]])
|
||||
end)
|
||||
@@ -563,17 +360,7 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
0123^456 |
|
||||
789 |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*11
|
||||
1,5 All |
|
||||
]])
|
||||
end)
|
||||
@@ -584,18 +371,7 @@ local function screen_tests(linegrid)
|
||||
feed(':ls')
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*12
|
||||
:ls^ |
|
||||
]])
|
||||
end)
|
||||
@@ -604,15 +380,7 @@ local function screen_tests(linegrid)
|
||||
feed(':ls<cr>')
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*9
|
||||
{1: }|
|
||||
:ls |
|
||||
1 %a "[No Name]" line 1 |
|
||||
@@ -789,9 +557,7 @@ local function screen_tests(linegrid)
|
||||
feed('iresize')
|
||||
screen:expect([[
|
||||
resize^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*3
|
||||
{2:-- INSERT --} |
|
||||
]])
|
||||
end)
|
||||
@@ -821,17 +587,14 @@ local function screen_tests(linegrid)
|
||||
screen:expect([[
|
||||
{2: + [No Name] }{3: }|
|
||||
resiz^e |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*2
|
||||
|
|
||||
]])
|
||||
screen:try_resize(30, 6)
|
||||
screen:expect([[
|
||||
{2: + [No Name] }{3: }|
|
||||
resiz^e |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*3
|
||||
|
|
||||
]])
|
||||
eq(29, meths.get_var('echospace'))
|
||||
@@ -840,15 +603,7 @@ local function screen_tests(linegrid)
|
||||
it('messages from the same Ex command as resize are visible #22225', function()
|
||||
feed(':set columns=20 | call<CR>')
|
||||
screen:expect([[
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|*9
|
||||
{1: }|
|
||||
{8:E471: Argument requi}|
|
||||
{8:red} |
|
||||
@@ -858,27 +613,12 @@ local function screen_tests(linegrid)
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*12
|
||||
|
|
||||
]])
|
||||
feed(':set columns=0<CR>')
|
||||
screen:expect([[
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|*5
|
||||
{1: }|
|
||||
{8:E594: Need a}|
|
||||
{8:t least 12 c}|
|
||||
@@ -892,18 +632,7 @@ local function screen_tests(linegrid)
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*12
|
||||
|
|
||||
]])
|
||||
end)
|
||||
@@ -915,15 +644,7 @@ local function screen_tests(linegrid)
|
||||
feed(':ls<CR>')
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*9
|
||||
{1: }|
|
||||
:ls |
|
||||
1 %a "[No Name]" line 1 |
|
||||
@@ -932,18 +653,7 @@ local function screen_tests(linegrid)
|
||||
feed('<F1>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*12
|
||||
TEST |
|
||||
]])
|
||||
end)
|
||||
@@ -956,35 +666,13 @@ local function screen_tests(linegrid)
|
||||
feed('ifooj')
|
||||
screen:expect([[
|
||||
foo^j |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*12
|
||||
{2:-- INSERT --} |
|
||||
]])
|
||||
feed('k')
|
||||
screen:expect([[
|
||||
fo^o |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*12
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user