refactor(tests): use new-style highlight spec in legacy/

This commit is contained in:
bfredl
2025-02-24 10:18:37 +01:00
parent 47cfe901d7
commit 90a63d242a
8 changed files with 422 additions and 464 deletions

View File

@@ -12,11 +12,9 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_relativenumber_colors()
it('LineNr, LineNrAbove and LineNrBelow', function()
local screen = Screen.new(50, 10)
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Red },
[2] = { foreground = Screen.colors.Blue },
[3] = { foreground = Screen.colors.Green },
})
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.WebGreen },
}
exec([[
call setline(1, range(200))
111
@@ -24,54 +22,54 @@ describe("'number' and 'relativenumber'", function()
hi LineNr guifg=red
]])
screen:expect([[
{1: 4 }106 |
{1: 3 }107 |
{1: 2 }108 |
{1: 1 }109 |
{1:111 }^110 |
{1: 1 }111 |
{1: 2 }112 |
{1: 3 }113 |
{1: 4 }114 |
{19: 4 }106 |
{19: 3 }107 |
{19: 2 }108 |
{19: 1 }109 |
{19:111 }^110 |
{19: 1 }111 |
{19: 2 }112 |
{19: 3 }113 |
{19: 4 }114 |
|
]])
command('hi LineNrAbove guifg=blue')
screen:expect([[
{2: 4 }106 |
{2: 3 }107 |
{2: 2 }108 |
{2: 1 }109 |
{1:111 }^110 |
{1: 1 }111 |
{1: 2 }112 |
{1: 3 }113 |
{1: 4 }114 |
{18: 4 }106 |
{18: 3 }107 |
{18: 2 }108 |
{18: 1 }109 |
{19:111 }^110 |
{19: 1 }111 |
{19: 2 }112 |
{19: 3 }113 |
{19: 4 }114 |
|
]])
command('hi LineNrBelow guifg=green')
screen:expect([[
{2: 4 }106 |
{2: 3 }107 |
{2: 2 }108 |
{2: 1 }109 |
{1:111 }^110 |
{3: 1 }111 |
{3: 2 }112 |
{3: 3 }113 |
{3: 4 }114 |
{18: 4 }106 |
{18: 3 }107 |
{18: 2 }108 |
{18: 1 }109 |
{19:111 }^110 |
{100: 1 }111 |
{100: 2 }112 |
{100: 3 }113 |
{100: 4 }114 |
|
]])
command('hi clear LineNrAbove')
screen:expect([[
{1: 4 }106 |
{1: 3 }107 |
{1: 2 }108 |
{1: 1 }109 |
{1:111 }^110 |
{3: 1 }111 |
{3: 2 }112 |
{3: 3 }113 |
{3: 4 }114 |
{19: 4 }106 |
{19: 3 }107 |
{19: 2 }108 |
{19: 1 }109 |
{19:111 }^110 |
{100: 1 }111 |
{100: 2 }112 |
{100: 3 }113 |
{100: 4 }114 |
|
]])
end)
@@ -79,12 +77,11 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_relativenumber_colors_wrapped()
it('LineNr, LineNrAbove and LineNrBelow with wrapped lines', function()
local screen = Screen.new(50, 20)
screen:set_default_attr_ids({
[1] = { background = Screen.colors.Red, foreground = Screen.colors.Black },
[2] = { background = Screen.colors.Blue, foreground = Screen.colors.Black },
[3] = { background = Screen.colors.Green, foreground = Screen.colors.Black },
[4] = { bold = true, foreground = Screen.colors.Blue },
})
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Gray0, background = Screen.colors.Red },
[101] = { foreground = Screen.colors.Gray0, background = Screen.colors.Blue1 },
[102] = { foreground = Screen.colors.Gray0, background = Screen.colors.WebGreen },
}
exec([[
set display=lastline scrolloff=0
call setline(1, range(200)->map('v:val->string()->repeat(40)'))
@@ -95,117 +92,117 @@ describe("'number' and 'relativenumber'", function()
hi LineNrBelow guibg=green guifg=black
]])
screen:expect([[
{2: 2 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 |
{2: 1 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 |
{1:111 }^1101101101101101101101101101101101101101101101|
{1: }1011011011011011011011011011011011011011011011|
{1: }0110110110110110110110110110 |
{3: 1 }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111 |
{3: 2 }1121121121121121121121121121121121121121121121|
{3: }1211211211211211211211211211211211211211211211|
{3: }2112112112112112112112112112 |
{3: 3 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 |
{3: 4 }1141141141141141141141141141141141141141141{4:@@@}|
{101: 2 }1081081081081081081081081081081081081081081081|
{101: }0810810810810810810810810810810810810810810810|
{101: }8108108108108108108108108108 |
{101: 1 }1091091091091091091091091091091091091091091091|
{101: }0910910910910910910910910910910910910910910910|
{101: }9109109109109109109109109109 |
{100:111 }^1101101101101101101101101101101101101101101101|
{100: }1011011011011011011011011011011011011011011011|
{100: }0110110110110110110110110110 |
{102: 1 }1111111111111111111111111111111111111111111111|
{102: }1111111111111111111111111111111111111111111111|
{102: }1111111111111111111111111111 |
{102: 2 }1121121121121121121121121121121121121121121121|
{102: }1211211211211211211211211211211211211211211211|
{102: }2112112112112112112112112112 |
{102: 3 }1131131131131131131131131131131131131131131131|
{102: }1311311311311311311311311311311311311311311311|
{102: }3113113113113113113113113113 |
{102: 4 }1141141141141141141141141141141141141141141{1:@@@}|
|
]])
feed('k')
screen:expect([[
{2: 1 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 |
{1:110 }^1091091091091091091091091091091091091091091091|
{1: }0910910910910910910910910910910910910910910910|
{1: }9109109109109109109109109109 |
{3: 1 }1101101101101101101101101101101101101101101101|
{3: }1011011011011011011011011011011011011011011011|
{3: }0110110110110110110110110110 |
{3: 2 }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111 |
{3: 3 }1121121121121121121121121121121121121121121121|
{3: }1211211211211211211211211211211211211211211211|
{3: }2112112112112112112112112112 |
{3: 4 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 |
{3: 5 }1141141141141141141141141141141141141141141{4:@@@}|
{101: 1 }1081081081081081081081081081081081081081081081|
{101: }0810810810810810810810810810810810810810810810|
{101: }8108108108108108108108108108 |
{100:110 }^1091091091091091091091091091091091091091091091|
{100: }0910910910910910910910910910910910910910910910|
{100: }9109109109109109109109109109 |
{102: 1 }1101101101101101101101101101101101101101101101|
{102: }1011011011011011011011011011011011011011011011|
{102: }0110110110110110110110110110 |
{102: 2 }1111111111111111111111111111111111111111111111|
{102: }1111111111111111111111111111111111111111111111|
{102: }1111111111111111111111111111 |
{102: 3 }1121121121121121121121121121121121121121121121|
{102: }1211211211211211211211211211211211211211211211|
{102: }2112112112112112112112112112 |
{102: 4 }1131131131131131131131131131131131131131131131|
{102: }1311311311311311311311311311311311311311311311|
{102: }3113113113113113113113113113 |
{102: 5 }1141141141141141141141141141141141141141141{1:@@@}|
|
]])
feed('2j')
screen:expect([[
{2: 3 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 |
{2: 2 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 |
{2: 1 }1101101101101101101101101101101101101101101101|
{2: }1011011011011011011011011011011011011011011011|
{2: }0110110110110110110110110110 |
{1:112 }^1111111111111111111111111111111111111111111111|
{1: }1111111111111111111111111111111111111111111111|
{1: }1111111111111111111111111111 |
{3: 1 }1121121121121121121121121121121121121121121121|
{3: }1211211211211211211211211211211211211211211211|
{3: }2112112112112112112112112112 |
{3: 2 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 |
{3: 3 }1141141141141141141141141141141141141141141{4:@@@}|
{101: 3 }1081081081081081081081081081081081081081081081|
{101: }0810810810810810810810810810810810810810810810|
{101: }8108108108108108108108108108 |
{101: 2 }1091091091091091091091091091091091091091091091|
{101: }0910910910910910910910910910910910910910910910|
{101: }9109109109109109109109109109 |
{101: 1 }1101101101101101101101101101101101101101101101|
{101: }1011011011011011011011011011011011011011011011|
{101: }0110110110110110110110110110 |
{100:112 }^1111111111111111111111111111111111111111111111|
{100: }1111111111111111111111111111111111111111111111|
{100: }1111111111111111111111111111 |
{102: 1 }1121121121121121121121121121121121121121121121|
{102: }1211211211211211211211211211211211211211211211|
{102: }2112112112112112112112112112 |
{102: 2 }1131131131131131131131131131131131131131131131|
{102: }1311311311311311311311311311311311311311311311|
{102: }3113113113113113113113113113 |
{102: 3 }1141141141141141141141141141141141141141141{1:@@@}|
|
]])
feed('2j')
screen:expect([[
{2: 5 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 |
{2: 4 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 |
{2: 3 }1101101101101101101101101101101101101101101101|
{2: }1011011011011011011011011011011011011011011011|
{2: }0110110110110110110110110110 |
{2: 2 }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111 |
{2: 1 }1121121121121121121121121121121121121121121121|
{2: }1211211211211211211211211211211211211211211211|
{2: }2112112112112112112112112112 |
{1:114 }^1131131131131131131131131131131131131131131131|
{1: }1311311311311311311311311311311311311311311311|
{1: }3113113113113113113113113113 |
{3: 1 }1141141141141141141141141141141141141141141{4:@@@}|
{101: 5 }1081081081081081081081081081081081081081081081|
{101: }0810810810810810810810810810810810810810810810|
{101: }8108108108108108108108108108 |
{101: 4 }1091091091091091091091091091091091091091091091|
{101: }0910910910910910910910910910910910910910910910|
{101: }9109109109109109109109109109 |
{101: 3 }1101101101101101101101101101101101101101101101|
{101: }1011011011011011011011011011011011011011011011|
{101: }0110110110110110110110110110 |
{101: 2 }1111111111111111111111111111111111111111111111|
{101: }1111111111111111111111111111111111111111111111|
{101: }1111111111111111111111111111 |
{101: 1 }1121121121121121121121121121121121121121121121|
{101: }1211211211211211211211211211211211211211211211|
{101: }2112112112112112112112112112 |
{100:114 }^1131131131131131131131131131131131131131131131|
{100: }1311311311311311311311311311311311311311311311|
{100: }3113113113113113113113113113 |
{102: 1 }1141141141141141141141141141141141141141141{1:@@@}|
|
]])
feed('k')
screen:expect([[
{2: 4 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 |
{2: 3 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 |
{2: 2 }1101101101101101101101101101101101101101101101|
{2: }1011011011011011011011011011011011011011011011|
{2: }0110110110110110110110110110 |
{2: 1 }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111 |
{1:113 }^1121121121121121121121121121121121121121121121|
{1: }1211211211211211211211211211211211211211211211|
{1: }2112112112112112112112112112 |
{3: 1 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 |
{3: 2 }1141141141141141141141141141141141141141141{4:@@@}|
{101: 4 }1081081081081081081081081081081081081081081081|
{101: }0810810810810810810810810810810810810810810810|
{101: }8108108108108108108108108108 |
{101: 3 }1091091091091091091091091091091091091091091091|
{101: }0910910910910910910910910910910910910910910910|
{101: }9109109109109109109109109109 |
{101: 2 }1101101101101101101101101101101101101101101101|
{101: }1011011011011011011011011011011011011011011011|
{101: }0110110110110110110110110110 |
{101: 1 }1111111111111111111111111111111111111111111111|
{101: }1111111111111111111111111111111111111111111111|
{101: }1111111111111111111111111111 |
{100:113 }^1121121121121121121121121121121121121121121121|
{100: }1211211211211211211211211211211211211211211211|
{100: }2112112112112112112112112112 |
{102: 1 }1131131131131131131131131131131131131131131131|
{102: }1311311311311311311311311311311311311311311311|
{102: }3113113113113113113113113113 |
{102: 2 }1141141141141141141141141141141141141141141{1:@@@}|
|
]])
end)