aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/mode_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/ui/mode_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/ui/mode_spec.lua')
-rw-r--r--test/functional/ui/mode_spec.lua69
1 files changed, 23 insertions, 46 deletions
diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua
index e870d6f25f..3d5f94cdce 100644
--- a/test/functional/ui/mode_spec.lua
+++ b/test/functional/ui/mode_spec.lua
@@ -24,24 +24,21 @@ describe('ui mode_change event', function()
it('works in normal mode', function()
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
feed('d')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="operator"}
feed('<esc>')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
end)
@@ -54,16 +51,14 @@ describe('ui mode_change event', function()
feed('c')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="operator"}
feed('c')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{4:E21: Cannot make changes, 'modifiable' is off} |
]], mode="normal"}
end)
@@ -73,16 +68,14 @@ describe('ui mode_change event', function()
feed('gr')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="replace"}
feed('<Esc>')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
end)
@@ -91,16 +84,14 @@ describe('ui mode_change event', function()
feed('i')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- INSERT --} |
]], mode="insert"}
feed('word<esc>')
screen:expect{grid=[[
wor^d |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
@@ -114,23 +105,20 @@ describe('ui mode_change event', function()
feed('a(stuff')
screen:expect{grid=[[
word(stuff^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- INSERT --} |
]], mode="insert", timeout=screen_timeout}
feed(')')
screen:expect{grid=[[
word^(stuff) |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- INSERT --} |
]], mode="showmatch", timeout=screen_timeout}
screen:expect{grid=[[
word(stuff)^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- INSERT --} |
]], mode="insert", timeout=screen_timeout}
end)
@@ -140,16 +128,14 @@ describe('ui mode_change event', function()
feed('R')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- REPLACE --} |
]], mode="replace"}
feed('word<esc>')
screen:expect{grid=[[
wor^d |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
end)
@@ -158,24 +144,21 @@ describe('ui mode_change event', function()
feed(':')
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
:^ |
]], mode="cmdline_normal"}
feed('x<left>')
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
:^x |
]], mode="cmdline_insert"}
feed('<insert>')
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
:^x |
]], mode="cmdline_replace"}
@@ -183,16 +166,14 @@ describe('ui mode_change event', function()
feed('<right>')
screen:expect{grid=[[
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
:x^ |
]], mode="cmdline_normal"}
feed('<esc>')
screen:expect{grid=[[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
end)
@@ -202,16 +183,14 @@ describe('ui mode_change event', function()
feed('v')
screen:expect{grid=[[
tex^t |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- VISUAL --} |
]], mode="visual"}
feed('<esc>')
screen:expect{grid=[[
tex^t |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
@@ -219,16 +198,14 @@ describe('ui mode_change event', function()
feed('v')
screen:expect{grid=[[
tex^t |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- VISUAL --} |
]], mode="visual_select"}
feed('<esc>')
screen:expect{grid=[[
tex^t |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]], mode="normal"}
end)