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:
@@ -182,10 +182,7 @@ describe('eval-API', function()
|
||||
{1:call} {2:bufnr}{3:(}{4:'%'}{3:)} |
|
||||
{1:call} {2:nvim_input}{3:(}{4:'typing...'}{3:)} |
|
||||
{1:call} not_a_function{3:(}{4:42}{3:^)} |
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|*4
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -114,8 +114,7 @@ describe('execute()', function()
|
||||
feed(':echo execute("hi ErrorMsg")<CR>')
|
||||
screen:expect([[
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|*2
|
||||
{2: }|
|
||||
|
|
||||
ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red |
|
||||
@@ -187,30 +186,21 @@ describe('execute()', function()
|
||||
feed([[:call Test1()<cr>]])
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*4
|
||||
ABCD |
|
||||
]])
|
||||
|
||||
feed([[:call Test2()<cr>]])
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*4
|
||||
1234ABCD |
|
||||
]])
|
||||
|
||||
feed([[:call Test3()<cr>]])
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*4
|
||||
1234ABCDXZYZ |
|
||||
]])
|
||||
|
||||
@@ -231,10 +221,7 @@ describe('execute()', function()
|
||||
feed([[:call Test5()<cr>]])
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*4
|
||||
1234ABCD |
|
||||
]])
|
||||
|
||||
@@ -273,9 +260,7 @@ describe('execute()', function()
|
||||
command('let g:mes = execute("echon 42", "")')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*3
|
||||
42 |
|
||||
]])
|
||||
eq('42', eval('g:mes'))
|
||||
@@ -295,9 +280,7 @@ describe('execute()', function()
|
||||
command('let g:mes = execute("echon 42")')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*3
|
||||
|
|
||||
]])
|
||||
eq('42', eval('g:mes'))
|
||||
@@ -305,9 +288,7 @@ describe('execute()', function()
|
||||
command('let g:mes = execute("echon 13", "silent")')
|
||||
screen:expect{grid=[[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*3
|
||||
|
|
||||
]], unchanged=true}
|
||||
eq('13', eval('g:mes'))
|
||||
|
||||
@@ -89,9 +89,7 @@ describe('input()', function()
|
||||
command('redraw!')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo}^ |
|
||||
]])
|
||||
end)
|
||||
@@ -100,17 +98,13 @@ describe('input()', function()
|
||||
feed([[:call input(1, 2)<CR>]])
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}2^ |
|
||||
]])
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}^ |
|
||||
]])
|
||||
end)
|
||||
@@ -120,25 +114,19 @@ describe('input()', function()
|
||||
feed([[:echo input(opts)<CR>]])
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}2^ |
|
||||
]])
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}^ |
|
||||
]])
|
||||
feed('<Esc>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:3} |
|
||||
]])
|
||||
end)
|
||||
@@ -148,33 +136,25 @@ describe('input()', function()
|
||||
feed([[:echo inputdialog(opts)<CR>]])
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Bar^ |
|
||||
]])
|
||||
command('mode')
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Bar^ |
|
||||
]], reset=true}
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Ba^ |
|
||||
]])
|
||||
command('mode')
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Ba^ |
|
||||
]], reset=true}
|
||||
end)
|
||||
@@ -183,9 +163,7 @@ describe('input()', function()
|
||||
feed([[:call input({})<CR>]])
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
^ |
|
||||
]])
|
||||
end)
|
||||
@@ -245,9 +223,7 @@ describe('input()', function()
|
||||
feed('(())')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{RBP1:(}{RBP2:()}{RBP1:)}^ |
|
||||
]])
|
||||
end)
|
||||
@@ -294,9 +270,7 @@ describe('inputdialog()', function()
|
||||
command('redraw!')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo}^ |
|
||||
]])
|
||||
end)
|
||||
@@ -305,17 +279,13 @@ describe('inputdialog()', function()
|
||||
feed([[:call inputdialog(1, 2)<CR>]])
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}2^ |
|
||||
]])
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}^ |
|
||||
]])
|
||||
end)
|
||||
@@ -325,25 +295,19 @@ describe('inputdialog()', function()
|
||||
feed([[:echo input(opts)<CR>]])
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}2^ |
|
||||
]])
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:1}^ |
|
||||
]])
|
||||
feed('<Esc>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:3} |
|
||||
]])
|
||||
end)
|
||||
@@ -353,33 +317,25 @@ describe('inputdialog()', function()
|
||||
feed([[:echo input(opts)<CR>]])
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Bar^ |
|
||||
]])
|
||||
command('mode')
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Bar^ |
|
||||
]], reset=true}
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Ba^ |
|
||||
]])
|
||||
command('mode')
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{T:Foo>}Ba^ |
|
||||
]], reset=true}
|
||||
end)
|
||||
@@ -388,9 +344,7 @@ describe('inputdialog()', function()
|
||||
feed(':echo inputdialog({})<CR>')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
^ |
|
||||
]])
|
||||
end)
|
||||
@@ -441,9 +395,7 @@ describe('inputdialog()', function()
|
||||
feed('(())')
|
||||
screen:expect([[
|
||||
|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|*3
|
||||
{RBP1:(}{RBP2:()}{RBP1:)}^ |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -148,9 +148,7 @@ describe('matchaddpos()', function()
|
||||
}}, funcs.getmatches())
|
||||
screen:expect([[
|
||||
^a{1:b}cdef |
|
||||
{2:~ }|
|
||||
{2:~ }|
|
||||
{2:~ }|
|
||||
{2:~ }|*3
|
||||
|
|
||||
]], {[1] = {foreground = Screen.colors.Red}, [2] = {bold = true, foreground = Screen.colors.Blue1}})
|
||||
end)
|
||||
|
||||
@@ -193,18 +193,7 @@ describe('system()', function()
|
||||
feed(':call system("echo")<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
:call system("echo") |
|
||||
]])
|
||||
end)
|
||||
@@ -250,18 +239,7 @@ describe('system()', function()
|
||||
or 'yes') .. '")<cr>')
|
||||
screen:expect([[
|
||||
|
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
]] .. (is_os('win')
|
||||
and [[
|
||||
:call system("for /L %I in (1,0,2) do @echo y") |]]
|
||||
@@ -270,18 +248,7 @@ describe('system()', function()
|
||||
feed('foo<c-c>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
Type :qa and press <Enter> to exit Nvim |
|
||||
]])
|
||||
end)
|
||||
@@ -293,18 +260,7 @@ describe('system()', function()
|
||||
or 'yes') .. '")<cr>')
|
||||
screen:expect([[
|
||||
|
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
]] .. (is_os('win')
|
||||
and [[
|
||||
:call system("for /L %I in (1,0,2) do @echo y") |]]
|
||||
@@ -313,18 +269,7 @@ describe('system()', function()
|
||||
feed('foo<c-c>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
-- INSERT -- |
|
||||
]])
|
||||
end)
|
||||
@@ -477,18 +422,7 @@ describe('systemlist()', function()
|
||||
feed(':call systemlist("echo")<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
:call systemlist("echo") |
|
||||
]])
|
||||
end)
|
||||
@@ -497,35 +431,13 @@ describe('systemlist()', function()
|
||||
feed(':call systemlist("yes | xargs")<cr>')
|
||||
screen:expect([[
|
||||
|
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
:call systemlist("yes | xargs") |
|
||||
]])
|
||||
feed('<c-c>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |*12
|
||||
Type :qa and press <Enter> to exit Nvim |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -133,9 +133,7 @@ describe('timers', function()
|
||||
screen:expect([[
|
||||
^ITEM 1 |
|
||||
ITEM 2 |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|*3
|
||||
|
|
||||
]])
|
||||
nvim_async("command", "let g:cont = 1")
|
||||
@@ -144,8 +142,7 @@ describe('timers', function()
|
||||
^ITEM 1 |
|
||||
ITEM 2 |
|
||||
ITEM 3 |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|*2
|
||||
|
|
||||
]])
|
||||
|
||||
@@ -155,8 +152,7 @@ describe('timers', function()
|
||||
^ITEM 1 |
|
||||
ITEM 2 |
|
||||
ITEM 3 |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|*2
|
||||
|
|
||||
]], unchanged=true}
|
||||
end)
|
||||
@@ -244,10 +240,7 @@ describe('timers', function()
|
||||
feed(":good")
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|*4
|
||||
:good^ |
|
||||
]])
|
||||
command('let g:val = 1')
|
||||
|
||||
Reference in New Issue
Block a user