aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-09 20:42:00 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-12-09 22:15:02 +0800
commit1037ce2e461034a20e35ad59969fd05d5ad68b91 (patch)
tree5cc490afac4607008bacf24d132015b63adfd1d0 /test/functional/api/vim_spec.lua
parent5e43630a260e49ed494539d41cb832b1ee6d03c8 (diff)
downloadrneovim-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/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua137
1 files changed, 30 insertions, 107 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 7a3116cba5..3d3b478d66 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -285,12 +285,7 @@ describe('API', function()
meths.exec2("echo 'hello'", { output = false })
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
hello |
]]}
end)
@@ -304,10 +299,7 @@ describe('API', function()
meths.exec2("echo 'hello'", { output = true })
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
|
]]}
exec([[
@@ -318,10 +310,7 @@ describe('API', function()
feed([[:echon 1 | call Print() | echon 5<CR>]])
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
15 |
]]}
end)
@@ -1140,8 +1129,7 @@ describe('API', function()
nvim('paste', '', true, 3)
screen:expect([[
|
- ~ |
- ~ |
+ ~ |*2
:Foo^ |
]])
end)
@@ -1152,8 +1140,7 @@ describe('API', function()
nvim('paste', 'normal! \023\022\006\027', true, -1)
screen:expect([[
|
- ~ |
- ~ |
+ ~ |*2
:normal! ^W^V^F^[^ |
]])
end)
@@ -2106,9 +2093,7 @@ describe('API', function()
feed([[:call nvim_out_write("\na\n")<CR>]])
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2: }|
|
a |
@@ -2118,8 +2103,7 @@ describe('API', function()
feed([[:call nvim_out_write("b\n\nc\n")<CR>]])
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2: }|
b |
|
@@ -2132,9 +2116,7 @@ describe('API', function()
feed([[:lua vim.api.nvim_out_write('aaa\0bbb\0\0ccc\nddd\0\0\0eee\n')<CR>]])
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2: }|
aaa{3:^@}bbb{3:^@^@}ccc |
ddd{3:^@^@^@}eee |
@@ -2161,12 +2143,7 @@ describe('API', function()
nvim_async('err_write', 'has bork\n')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
{1:has bork} |
]])
end)
@@ -2175,9 +2152,7 @@ describe('API', function()
nvim_async('err_write', 'something happened\nvery bad\n')
screen:expect([[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{3: }|
{1:something happened} |
{1:very bad} |
@@ -2205,12 +2180,7 @@ describe('API', function()
nvim_async('err_write', 'fail\n')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
{1:very fail} |
]])
helpers.poke_eventloop()
@@ -2219,9 +2189,7 @@ describe('API', function()
nvim_async('err_write', 'more fail\ntoo fail\n')
screen:expect([[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{3: }|
{1:more fail} |
{1:too fail} |
@@ -2234,9 +2202,7 @@ describe('API', function()
nvim_async('err_write', 'aaa\0bbb\0\0ccc\nddd\0\0\0eee\n')
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{3: }|
{1:aaa^@bbb^@^@ccc} |
{1:ddd^@^@^@eee} |
@@ -2274,12 +2240,7 @@ describe('API', function()
feed('<CR>')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
|
]])
end)
@@ -2859,8 +2820,7 @@ describe('API', function()
meths.set_current_buf(2)
screen:expect([[
^some text |
- {1:~ }|
- {1:~ }|
+ {1:~ }|*2
|
]], {
[1] = {bold = true, foreground = Screen.colors.Blue1},
@@ -2937,8 +2897,7 @@ describe('API', function()
meths.set_current_buf(edited_buf)
screen:expect([[
^some text |
- {1:~ }|
- {1:~ }|
+ {1:~ }|*2
|
]])
eq('nofile', meths.get_option_value('buftype', {buf=edited_buf}))
@@ -2950,8 +2909,7 @@ describe('API', function()
command('bwipe')
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
+ {1:~ }|*2
|
]])
end)
@@ -3229,12 +3187,7 @@ describe('API', function()
feed(':call nvim_echo([["msg"]], v:false, {})<CR>')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
msg |
]]}
end)
@@ -3243,12 +3196,7 @@ describe('API', function()
nvim_async("echo", {{"msg_a"}, {"msg_b", "Statement"}, {"msg_c", "Special"}}, true, {})
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
msg_a{3:msg_b}{4:msg_c} |
]]}
end)
@@ -3257,9 +3205,7 @@ describe('API', function()
nvim_async("echo", {{"msg_a\nmsg_a", "Statement"}, {"msg_b", "Special"}}, true, {})
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2: }|
{3:msg_a} |
{3:msg_a}{4:msg_b} |
@@ -3338,8 +3284,7 @@ describe('API', function()
{0:~}{3:Press ENTER or type command to continue}{1: }{0: }|
{0:~}{4:term://~/config2/docs/pres//32693:vim --clean +smile 29,39 All}{0: }|
{0:~}{1::call nvim__screenshot("smile2.cat") }{0: }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]]}
end)
@@ -3367,13 +3312,8 @@ describe('API', function()
screen:expect{grid=[[
|
{0:~}{1:^ }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~}{1: }{0: }|*4
+ {0:~ }|*3
|
]]}
@@ -3381,13 +3321,8 @@ describe('API', function()
screen:expect{grid=[[
|
{0:~}{7: }{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~}{1: }{0: }|*4
+ {0:~ }|*3
{6:-- TERMINAL --} |
]]}
@@ -3400,13 +3335,8 @@ describe('API', function()
screen:expect{grid=[[
|
{0:~}{1:herrejösses!}{7: }{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~}{1: }{0: }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~}{1: }{0: }|*4
+ {0:~ }|*3
{6:-- TERMINAL --} |
]]}
eq('ba\024blaherrejösses!', exec_lua [[ return stream ]])
@@ -4159,8 +4089,7 @@ describe('API', function()
screen:expect([[
foo |
bar |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1: }|
Entering Ex mode. Type "visual" to go to Normal mode. |
:1^ |
@@ -4518,10 +4447,7 @@ describe('API', function()
meths.cmd({cmd = 'echo', args = {[['hello']]}}, {output = true})
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
|
]]}
exec([[
@@ -4532,10 +4458,7 @@ describe('API', function()
feed([[:echon 1 | call Print() | echon 5<CR>]])
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
15 |
]]}
end)