fix(tests): use more global highlight definitions

This commit is contained in:
bfredl 2024-04-08 08:32:45 +02:00
parent c695caa7ee
commit 3d44340cea
4 changed files with 1158 additions and 1246 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -237,13 +237,6 @@ describe("'inccommand' for user commands", function()
before_each(function()
clear()
screen = Screen.new(40, 17)
screen:set_default_attr_ids({
[1] = { background = Screen.colors.Yellow1 },
[2] = { foreground = Screen.colors.Blue1, bold = true },
[3] = { reverse = true },
[4] = { reverse = true, bold = true },
[5] = { foreground = Screen.colors.Blue },
})
screen:attach()
exec_lua(setup_replace_cmd)
command('set cmdwinheight=5')
@ -263,16 +256,16 @@ describe("'inccommand' for user commands", function()
command('set inccommand=nosplit')
feed(':Replace text cats')
screen:expect([[
{1:cats} on line 1 |
more {1:cats} on line 2 |
oh no, even more {1:cats} |
will the {1:cats} ever stop |
{10:cats} on line 1 |
more {10:cats} on line 2 |
oh no, even more {10:cats} |
will the {10:cats} ever stop |
oh well |
did the {1:cats} stop |
did the {10:cats} stop |
why won't it stop |
make the {1:cats} stop |
make the {10:cats} stop |
|
{2:~ }|*7
{1:~ }|*7
:Replace text cats^ |
]])
end)
@ -281,22 +274,22 @@ describe("'inccommand' for user commands", function()
command('set inccommand=split')
feed(':Replace text cats')
screen:expect([[
{1:cats} on line 1 |
more {1:cats} on line 2 |
oh no, even more {1:cats} |
will the {1:cats} ever stop |
{10:cats} on line 1 |
more {10:cats} on line 2 |
oh no, even more {10:cats} |
will the {10:cats} ever stop |
oh well |
did the {1:cats} stop |
did the {10:cats} stop |
why won't it stop |
make the {1:cats} stop |
make the {10:cats} stop |
|
{4:[No Name] [+] }|
|1| {1:cats} on line 1 |
|2| more {1:cats} on line 2 |
|3| oh no, even more {1:cats} |
|4| will the {1:cats} ever stop |
|6| did the {1:cats} stop |
{3:[Preview] }|
{3:[No Name] [+] }|
|1| {10:cats} on line 1 |
|2| more {10:cats} on line 2 |
|3| oh no, even more {10:cats} |
|4| will the {10:cats} ever stop |
|6| did the {10:cats} stop |
{2:[Preview] }|
:Replace text cats^ |
]])
end)
@ -314,7 +307,7 @@ describe("'inccommand' for user commands", function()
why won't it stop |
make the text stop |
^ |
{2:~ }|*7
{1:~ }|*7
|
]])
end)
@ -332,7 +325,7 @@ describe("'inccommand' for user commands", function()
why won't it stop |
make the cats stop |
^ |
{2:~ }|*7
{1:~ }|*7
:Replace text cats |
]])
end)
@ -341,7 +334,7 @@ describe("'inccommand' for user commands", function()
command('set inccommand=split')
feed('gg:.Replace text cats')
screen:expect([[
{1:cats} on line 1 |
{10:cats} on line 1 |
more text on line 2 |
oh no, even more text |
will the text ever stop |
@ -350,7 +343,7 @@ describe("'inccommand' for user commands", function()
why won't it stop |
make the text stop |
|
{2:~ }|*7
{1:~ }|*7
:.Replace text cats^ |
]])
end)
@ -394,7 +387,7 @@ describe("'inccommand' for user commands", function()
]])
feed(':C')
screen:expect([[
{1: cats on line 1} |
{10: cats on line 1} |
more cats on line 2 |
oh no, even more cats |
will the cats ever stop |
@ -403,7 +396,7 @@ describe("'inccommand' for user commands", function()
why won't it stop |
make the cats stop |
|
{2:~ }|*7
{1:~ }|*7
:C^ |
]])
assert_alive()
@ -453,7 +446,7 @@ describe("'inccommand' for user commands", function()
why won't it stop |
make the text stop |
a.a.a.a. |
{2:~ }|*7
{1:~ }|*7
:Test a.a.a.a.^ |
]])
feed('<C-V><Esc>u')
@ -467,8 +460,8 @@ describe("'inccommand' for user commands", function()
why won't it stop |
make the text stop |
a.a.a. |
{2:~ }|*7
:Test a.a.a.a.{5:^[}u^ |
{1:~ }|*7
:Test a.a.a.a.{18:^[}u^ |
]])
feed('<Esc>')
screen:expect([[
@ -481,7 +474,7 @@ describe("'inccommand' for user commands", function()
why won't it stop |
make the text stop |
^ |
{2:~ }|*7
{1:~ }|*7
|
]])
end
@ -521,12 +514,6 @@ describe("'inccommand' with multiple buffers", function()
before_each(function()
clear()
screen = Screen.new(40, 17)
screen:set_default_attr_ids({
[1] = { background = Screen.colors.Yellow1 },
[2] = { foreground = Screen.colors.Blue1, bold = true },
[3] = { reverse = true },
[4] = { reverse = true, bold = true },
})
screen:attach()
exec_lua(setup_replace_cmd)
command('set cmdwinheight=10')
@ -547,12 +534,12 @@ describe("'inccommand' with multiple buffers", function()
command('set inccommand=nosplit')
feed(':Replace foo bar')
screen:expect([[
bar baz {1:bar} {1:bar} bar baz |
baz {1:bar} bar bar baz {1:bar} |
{1:bar} bar baz baz {1:bar} bar |
bar baz {10:bar} {10:bar} bar baz |
baz {10:bar} bar bar baz {10:bar} |
{10:bar} bar baz baz {10:bar} bar |
|
{2:~ }{2:~ }|*11
{4:[No Name] [+] }{3:[No Name] [+] }|
{1:~ }{1:~ }|*11
{3:[No Name] [+] }{2:[No Name] [+] }|
:Replace foo bar^ |
]])
feed('<CR>')
@ -561,8 +548,8 @@ describe("'inccommand' with multiple buffers", function()
baz bar bar bar baz bar |
bar bar baz baz bar bar |
^ |
{2:~ }{2:~ }|*11
{4:[No Name] [+] }{3:[No Name] [+] }|
{1:~ }{1:~ }|*11
{3:[No Name] [+] }{2:[No Name] [+] }|
:Replace foo bar |
]])
end)
@ -571,22 +558,22 @@ describe("'inccommand' with multiple buffers", function()
command('set inccommand=split')
feed(':Replace foo bar')
screen:expect([[
bar baz {1:bar} {1:bar} bar baz |
baz {1:bar} bar bar baz {1:bar} |
{1:bar} bar baz baz {1:bar} bar |
bar baz {10:bar} {10:bar} bar baz |
baz {10:bar} bar bar baz {10:bar} |
{10:bar} bar baz baz {10:bar} bar |
|
{4:[No Name] [+] }{3:[No Name] [+] }|
{3:[No Name] [+] }{2:[No Name] [+] }|
Buffer #1: |
|1| {1:bar} bar baz |
|2| bar baz {1:bar} |
|3| baz {1:bar} bar |
|1| {10:bar} bar baz |
|2| bar baz {10:bar} |
|3| baz {10:bar} bar |
Buffer #2: |
|1| bar baz {1:bar} |
|2| baz {1:bar} bar |
|3| {1:bar} bar baz |
|1| bar baz {10:bar} |
|2| baz {10:bar} bar |
|3| {10:bar} bar baz |
|
{2:~ }|
{3:[Preview] }|
{1:~ }|
{2:[Preview] }|
:Replace foo bar^ |
]])
feed('<CR>')
@ -595,8 +582,8 @@ describe("'inccommand' with multiple buffers", function()
baz bar bar bar baz bar |
bar bar baz baz bar bar |
^ |
{2:~ }{2:~ }|*11
{4:[No Name] [+] }{3:[No Name] [+] }|
{1:~ }{1:~ }|*11
{3:[No Name] [+] }{2:[No Name] [+] }|
:Replace foo bar |
]])
end)

View File

@ -108,20 +108,15 @@ describe('shell command :!', function()
it('handles control codes', function()
skip(is_os('win'), 'missing printf')
local screen = Screen.new(50, 4)
screen:set_default_attr_ids {
[1] = { bold = true, reverse = true },
[2] = { bold = true, foreground = Screen.colors.SeaGreen },
[3] = { foreground = Screen.colors.Blue },
}
screen:attach()
-- Print TAB chars. #2958
feed([[:!printf '1\t2\t3'<CR>]])
screen:expect {
grid = [[
{1: }|
{3: }|
:!printf '1\t2\t3' |
1 2 3 |
{2:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]],
}
feed([[<CR>]])
@ -131,10 +126,10 @@ describe('shell command :!', function()
feed([[:!printf '\007\007\007\007text'<CR>]])
screen:expect {
grid = [[
{1: }|
{3: }|
:!printf '\007\007\007\007text' |
text |
{2:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]],
condition = function()
eq(true, screen.bell)
@ -145,10 +140,10 @@ describe('shell command :!', function()
-- Print BS control code.
feed([[:echo system('printf ''\010\n''')<CR>]])
screen:expect([[
{1: }|
{3:^H} |
{3: }|
{18:^H} |
|
{2:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]])
feed([[<CR>]])
@ -157,7 +152,7 @@ describe('shell command :!', function()
screen:expect([[
:!printf '\n' |
|*2
{2:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]])
feed([[<CR>]])
end)
@ -171,12 +166,6 @@ describe('shell command :!', function()
write_file('bang_filter_spec/f2', 'f2')
write_file('bang_filter_spec/f3', 'f3')
screen = Screen.new(53, 10)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.Blue1 },
[3] = { bold = true, foreground = Screen.colors.SeaGreen4 },
[4] = { bold = true, reverse = true },
})
screen:attach()
end)
@ -196,13 +185,13 @@ describe('shell command :!', function()
screen:expect([[
|
{1:~ }|*2
{4: }|
{3: }|
]] .. result .. [[ |
f1 |
f2 |
f3 |
|
{3:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]])
end)
@ -213,14 +202,14 @@ describe('shell command :!', function()
grid = [[
|
{1:~ }|
{4: }|
{3: }|
:!cat test/functional/fixtures/shell_data.txt |
{2:^@^A^B^C^D^E^F^H} |
{2:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} |
ö {2:<a5><c3>} |
t {2:<ff>} |
{18:^@^A^B^C^D^E^F^H} |
{18:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} |
ö {18:<a5><c3>} |
t {18:<ff>} |
|
{3:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]],
condition = function()
eq(true, screen.bell)
@ -235,7 +224,7 @@ describe('shell command :!', function()
-- Note: only the first example of split composed char works
screen:expect([[
|
{4: }|
{3: }|
:]] .. cmd .. [[ |
å |
ref: å̲ |
@ -243,7 +232,7 @@ describe('shell command :!', function()
2: å ̲ |
3: å ̲ |
|
{3:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]])
end)
end)