From 1037ce2e461034a20e35ad59969fd05d5ad68b91 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 9 Dec 2023 20:42:00 +0800 Subject: 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 --- test/functional/ui/mode_spec.lua | 69 ++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 46 deletions(-) (limited to 'test/functional/ui/mode_spec.lua') 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('') 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('') 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') 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') 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') screen:expect{grid=[[ | - {0:~ }| - {0:~ }| + {0:~ }|*2 :^x | ]], mode="cmdline_insert"} feed('') screen:expect{grid=[[ | - {0:~ }| - {0:~ }| + {0:~ }|*2 :^x | ]], mode="cmdline_replace"} @@ -183,16 +166,14 @@ describe('ui mode_change event', function() feed('') screen:expect{grid=[[ | - {0:~ }| - {0:~ }| + {0:~ }|*2 :x^ | ]], mode="cmdline_normal"} feed('') 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('') 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('') screen:expect{grid=[[ tex^t | - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]], mode="normal"} end) -- cgit