diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-09 20:42:00 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-12-09 22:15:02 +0800 |
commit | 1037ce2e461034a20e35ad59969fd05d5ad68b91 (patch) | |
tree | 5cc490afac4607008bacf24d132015b63adfd1d0 /test/functional/lua | |
parent | 5e43630a260e49ed494539d41cb832b1ee6d03c8 (diff) | |
download | rneovim-1037ce2e461034a20e35ad59969fd05d5ad68b91.tar.gz rneovim-1037ce2e461034a20e35ad59969fd05d5ad68b91.tar.bz2 rneovim-1037ce2e461034a20e35ad59969fd05d5ad68b91.zip |
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
Diffstat (limited to 'test/functional/lua')
-rw-r--r-- | test/functional/lua/commands_spec.lua | 9 | ||||
-rw-r--r-- | test/functional/lua/loop_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/lua/luaeval_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/lua/overrides_spec.lua | 88 | ||||
-rw-r--r-- | test/functional/lua/secure_spec.lua | 40 | ||||
-rw-r--r-- | test/functional/lua/thread_spec.lua | 36 | ||||
-rw-r--r-- | test/functional/lua/ui_event_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/lua/vim_spec.lua | 16 |
8 files changed, 35 insertions, 188 deletions
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua index fca619348d..d8a68219c1 100644 --- a/test/functional/lua/commands_spec.lua +++ b/test/functional/lua/commands_spec.lua @@ -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'))) diff --git a/test/functional/lua/loop_spec.lua b/test/functional/lua/loop_spec.lua index c0924fa0c0..4f98fe0977 100644 --- a/test/functional/lua/loop_spec.lua +++ b/test/functional/lua/loop_spec.lua @@ -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")) diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua index dfbd2fb18b..3810d44538 100644 --- a/test/functional/lua/luaeval_spec.lua +++ b/test/functional/lua/luaeval_spec.lua @@ -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', {}) diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua index c08f3d06a9..f3ea29b8a7 100644 --- a/test/functional/lua/overrides_spec.lua +++ b/test/functional/lua/overrides_spec.lua @@ -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) diff --git a/test/functional/lua/secure_spec.lua b/test/functional/lua/secure_spec.lua index fc20a06390..c59d3f3cda 100644 --- a/test/functional/lua/secure_spec.lua +++ b/test/functional/lua/secure_spec.lua @@ -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:~ }| diff --git a/test/functional/lua/thread_spec.lua b/test/functional/lua/thread_spec.lua index e79d26a641..23c0c42f07 100644 --- a/test/functional/lua/thread_spec.lua +++ b/test/functional/lua/thread_spec.lua @@ -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} | diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 2d1ee54506..04ffeddc87 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -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 { diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index ebe5fc254e..1ef214d611 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -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...")]] |