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:
zeertzjq
2023-12-09 20:42:00 +08:00
parent 5e43630a26
commit 1037ce2e46
127 changed files with 3495 additions and 15660 deletions

View File

@@ -117,14 +117,7 @@ describe(':lua command', function()
feed('<cr>')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*8
|
]]}
eq('E5108: Error executing lua [string ":lua"]:1: fail\nmuch error\nsuch details', remove_trace(eval('v:errmsg')))

View File

@@ -112,14 +112,7 @@ describe('vim.uv', function()
screen:expect([[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*8
howdy |
]])
eq(true, eval("get(g:, 'valid', v:false)"))
@@ -137,14 +130,7 @@ describe('vim.uv', function()
]])
screen:expect([[
sneaky^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*8
{5:-- INSERT --} |
]])
eq({blocking=false, mode='n'}, exec_lua("return _G.mode"))

View File

@@ -521,9 +521,7 @@ describe('v:lua', function()
{1:~ }{2: stuff }{1: }|
{1:~ }{3: steam }{1: }|
{1:~ }{3: strange things }{1: }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{4:-- Omni completion (^O^N^P) }{5:match 1 of 3} |
]]}
meths.set_option_value('operatorfunc', 'v:lua.mymod.noisy', {})

View File

@@ -148,9 +148,7 @@ describe('print', function()
feed([[:lua print('\na')<CR>]])
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*3
{2: }|
|
a |
@@ -160,8 +158,7 @@ describe('print', function()
feed([[:lua print('b\n\nc')<CR>]])
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|*2
{2: }|
b |
|
@@ -196,16 +193,7 @@ describe('debug.debug', function()
feed(':lua Test()\n')
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*10
{1: }|
nil |
lua_debug> ^ |
@@ -213,14 +201,7 @@ describe('debug.debug', function()
feed('print("TEST")\n')
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*8
{1: }|
nil |
lua_debug> print("TEST") |
@@ -230,8 +211,7 @@ describe('debug.debug', function()
feed('<C-c>')
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|*2
{1: }|
nil |
lua_debug> print("TEST") |
@@ -247,16 +227,7 @@ describe('debug.debug', function()
feed('<C-l>:lua Test()\n')
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*10
{1: }|
nil |
lua_debug> ^ |
@@ -264,10 +235,7 @@ describe('debug.debug', function()
feed('\n')
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*4
{1: }|
nil |
lua_debug> |
@@ -285,32 +253,14 @@ describe('debug.debug', function()
feed(':lua debug.debug() print("x")<cr>')
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*12
lua_debug> ^ |
]]}
feed("conttt<cr>") -- misspelled cont; invalid syntax
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*8
{1: }|
lua_debug> conttt |
{E:E5115: Error while loading debug string: (debug comma}|
@@ -321,12 +271,7 @@ describe('debug.debug', function()
feed("cont<cr>") -- exactly "cont", exit now
screen:expect{grid=[[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*6
{1: }|
lua_debug> conttt |
{E:E5115: Error while loading debug string: (debug comma}|
@@ -339,18 +284,7 @@ describe('debug.debug', function()
feed('<cr>')
screen:expect{grid=[[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*12
|
]]}
end)

View File

@@ -48,9 +48,7 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect{grid=[[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
@@ -59,12 +57,7 @@ describe('vim.secure', function()
feed('d')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*6
|
]]}
@@ -77,9 +70,7 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect{grid=[[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
@@ -88,12 +79,7 @@ describe('vim.secure', function()
feed('a')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*6
|
]]}
@@ -107,9 +93,7 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect{grid=[[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
@@ -118,12 +102,7 @@ describe('vim.secure', function()
feed('i')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*6
|
]]}
@@ -134,9 +113,7 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect{grid=[[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
@@ -145,8 +122,7 @@ describe('vim.secure', function()
feed('v')
screen:expect{grid=[[
^let g:foobar = 42 |
{1:~ }|
{1:~ }|
{1:~ }|*2
{2:]] .. funcs.fnamemodify(cwd, ':~') .. pathsep .. [[Xfile [RO]{MATCH:%s+}}|
|
{1:~ }|

View File

@@ -35,11 +35,7 @@ describe('thread', function()
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*5
{2: }|
{3:Error in luv thread:} |
{3:[string "<nvim>"]:2: Error in thread entry func} |
@@ -66,11 +62,7 @@ describe('thread', function()
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*5
{2: }|
{3:Error in luv callback, thread:} |
{3:[string "<nvim>"]:6: Error in thread callback} |
@@ -91,14 +83,7 @@ describe('thread', function()
screen:expect([[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*8
print in thread |
]])
end)
@@ -113,14 +98,7 @@ describe('thread', function()
screen:expect([[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*8
{ 1, 2 } |
]])
end)
@@ -294,11 +272,7 @@ describe('threadpool', function()
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*5
{2: }|
{3:Error in luv thread:} |
{3:Error: thread arg not support type 'table' at 1} |

View File

@@ -46,18 +46,14 @@ describe('vim.ui_attach', function()
feed('ifo')
screen:expect{grid=[[
fo^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{2:-- INSERT --} |
]]}
funcs.complete(1, {'food', 'foobar', 'foo'})
screen:expect{grid=[[
food^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{2:-- INSERT --} |
]]}
expect_events {
@@ -67,9 +63,7 @@ describe('vim.ui_attach', function()
feed '<c-n>'
screen:expect{grid=[[
foobar^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
{2:-- INSERT --} |
]]}
expect_events {

View File

@@ -271,9 +271,7 @@ describe('lua stdlib', function()
screen:attach()
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|*3
|
]]}
@@ -2798,25 +2796,19 @@ describe('lua stdlib', function()
screen:attach()
screen:expect{grid=[[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*3
|
]]}
exec_lua [[vim.notify_once("I'll only tell you this once...", vim.log.levels.WARN)]]
screen:expect{grid=[[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*3
{1:I'll only tell you this once...} |
]]}
feed('<C-l>')
screen:expect{grid=[[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|*3
|
]]}
exec_lua [[vim.notify_once("I'll only tell you this once...")]]