refactor(tests): continue the global highlight definition work

This commit is contained in:
bfredl 2024-11-08 11:45:55 +01:00
parent 8ab1903092
commit abe6a07c54
6 changed files with 206 additions and 254 deletions

View File

@ -382,11 +382,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_with_cursorcolumn()
it('CursorColumn and ColorColumn on wrapped line', function()
local screen = Screen.new(40, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Grey90 }, -- CursorColumn
[2] = { background = Screen.colors.LightRed }, -- ColorColumn
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.LightRed },
}
screen:attach()
-- Check that cursorcolumn and colorcolumn don't get broken in presence of
-- wrapped lines containing concealed text
@ -408,12 +406,12 @@ describe('Conceal', function()
-- luacheck: pop
screen:expect([[
one one one one one one {1:o}ne |
{0: >>> }one {2:o}ne one one |
one one one one one one {21:o}ne |
{1: >>> }one {100:o}ne one one |
two two two two |hidden| ^here two two |
three three three three {1:t}hree |
{0: >>> }thre{2:e} three three three |
{0:~ }|*4
three three three three {21:t}hree |
{1: >>> }thre{100:e} three three three |
{1:~ }|*4
/here |
]])
@ -421,11 +419,11 @@ describe('Conceal', function()
feed('$')
screen:expect([[
one one one one one one one |
{0: >>> }one {2:o}ne one one |
{1: >>> }one {100:o}ne one one |
two two two two |hidden| here two tw^o |
three three three three three |
{0: >>> }thre{2:e} three three three |
{0:~ }|*4
{1: >>> }thre{100:e} three three three |
{1:~ }|*4
/here |
]])
end)
@ -433,11 +431,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_wrapped_cursorline_wincolor()
it('CursorLine highlight on wrapped lines', function()
local screen = Screen.new(40, 4)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Green }, -- CursorLine (low-priority)
[2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.WebGreen },
}
screen:attach()
exec([[
call setline(1, 'one one one |hidden| one one one one one one one one')
@ -447,16 +443,16 @@ describe('Conceal', function()
hi! CursorLine guibg=Green
]])
screen:expect([[
{1:one one one one one one one on^e }|
{1: one one one }|
{0:~ }|
{100:one one one one one one one on^e }|
{100: one one one }|
{1:~ }|
|
]])
command('hi! CursorLine guibg=NONE guifg=Red')
screen:expect([[
{2:one one one one one one one on^e }|
{2: one one one }|
{0:~ }|
{19:one one one one one one one on^e }|
{19: one one one }|
{1:~ }|
|
]])
end)
@ -464,11 +460,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_wrapped_cursorline_wincolor_rightleft()
it('CursorLine highlight on wrapped lines with rightleft', function()
local screen = Screen.new(40, 4)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Green }, -- CursorLine (low-priority)
[2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.WebGreen },
}
screen:attach()
exec([[
call setline(1, 'one one one |hidden| one one one one one one one one')
@ -478,16 +472,16 @@ describe('Conceal', function()
hi! CursorLine guibg=Green
]])
screen:expect([[
{1: ^eno eno eno eno eno eno eno eno}|
{1: eno eno eno }|
{0: ~}|
{100: ^eno eno eno eno eno eno eno eno}|
{100: eno eno eno }|
{1: ~}|
|
]])
command('hi! CursorLine guibg=NONE guifg=Red')
screen:expect([[
{2: ^eno eno eno eno eno eno eno eno}|
{2: eno eno eno }|
{0: ~}|
{19: ^eno eno eno eno eno eno eno eno}|
{19: eno eno eno }|
{1: ~}|
|
]])
end)
@ -625,9 +619,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol(wrap)
local screen = Screen.new(60, 3)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
@ -638,31 +629,31 @@ describe('Conceal', function()
]])
screen:expect([[
abcdefghijklmnpo^p |
{0:~ }|
{1:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop^ |
{0:~ }|
{1:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop ^ |
{0:~ }|
{1:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop ^ |
{0:~ }|
{1:~ }|
|
]])
feed('rr')
screen:expect([[
abcdefghijklmnpop ^r |
{0:~ }|
{1:~ }|
|
]])
end
@ -679,9 +670,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol_rightleft(wrap)
local screen = Screen.new(60, 3)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
@ -692,31 +680,31 @@ describe('Conceal', function()
]])
screen:expect([[
^popnmlkjihgfedcba|
{0: ~}|
{1: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
{0: ~}|
{1: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
{0: ~}|
{1: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
{0: ~}|
{1: ~}|
|
]])
feed('rr')
screen:expect([[
^r popnmlkjihgfedcba|
{0: ~}|
{1: ~}|
|
]])
end
@ -733,11 +721,9 @@ describe('Conceal', function()
local function test_conceal_double_width(wrap)
local screen = Screen.new(60, 4)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
[2] = { background = Screen.colors.LightRed },
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.LightRed },
}
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
@ -747,30 +733,30 @@ describe('Conceal', function()
normal! $
]])
screen:expect([[
aaaaa{1:β}bbbbb{1:β}cccc^c {2: } |
foobar {2: } |
{0:~ }|
aaaaa{14:β}bbbbb{14:β}cccc^c {100: } |
foobar {100: } |
{1:~ }|
|
]])
feed('gM')
screen:expect([[
aaaaa{1:β}bb^bbb{1:β}ccccc {2: } |
foobar {2: } |
{0:~ }|
aaaaa{14:β}bb^bbb{14:β}ccccc {100: } |
foobar {100: } |
{1:~ }|
|
]])
command('set conceallevel=3')
screen:expect([[
aaaaabb^bbbccccc {2: } |
foobar {2: } |
{0:~ }|
aaaaabb^bbbccccc {100: } |
foobar {100: } |
{1:~ }|
|
]])
feed('$')
screen:expect([[
aaaaabbbbbcccc^c {2: } |
foobar {2: } |
{0:~ }|
aaaaabbbbbcccc^c {100: } |
foobar {100: } |
{1:~ }|
|
]])
end
@ -788,11 +774,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_double_width_wrap()
it('line wraps correctly when double-width chars are concealed', function()
local screen = Screen.new(20, 4)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
[2] = { background = Screen.colors.LightRed },
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.LightRed },
}
screen:attach()
exec([[
call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc')
@ -801,30 +785,30 @@ describe('Conceal', function()
normal! $
]])
screen:expect([[
aaaaaaaaaa{1:β}bbbbb |
bbbbb{1:β}ccccccccc^c |
{0:~ }|
aaaaaaaaaa{14:β}bbbbb |
bbbbb{14:β}ccccccccc^c |
{1:~ }|
|
]])
feed('gM')
screen:expect([[
aaaaaaaaaa{1:β}bbbbb |
^bbbbb{1:β}cccccccccc |
{0:~ }|
aaaaaaaaaa{14:β}bbbbb |
^bbbbb{14:β}cccccccccc |
{1:~ }|
|
]])
command('set conceallevel=3')
screen:expect([[
aaaaaaaaaabbbbb |
^bbbbbcccccccccc |
{0:~ }|
{1:~ }|
|
]])
feed('$')
screen:expect([[
aaaaaaaaaabbbbb |
bbbbbccccccccc^c |
{0:~ }|
{1:~ }|
|
]])
end)

View File

@ -34,20 +34,19 @@ describe('matchparen', function()
-- oldtest: Test_matchparen_clear_highlight()
it('matchparen highlight is cleared when switching buffer', function()
local screen = Screen.new(20, 5)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.Cyan },
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}
screen:attach()
local screen1 = [[
{1:^()} |
{0:~ }|*3
{100:^()} |
{1:~ }|*3
|
]]
local screen2 = [[
^aa |
{0:~ }|*3
{1:~ }|*3
|
]]
@ -77,11 +76,9 @@ describe('matchparen', function()
-- oldtest: Test_matchparen_win_execute()
it('matchparen highlight when switching buffer in win_execute()', function()
local screen = Screen.new(20, 5)
screen:set_default_attr_ids({
[1] = { background = Screen.colors.Cyan },
[2] = { reverse = true, bold = true },
[3] = { reverse = true },
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}
screen:attach()
exec([[
@ -95,10 +92,10 @@ describe('matchparen', function()
endfunc
]])
screen:expect([[
{1:^{}} |
{2:[No Name] [+] }|
{} |
{100:^{}} |
{3:[No Name] [+] }|
{} |
{2:[No Name] [+] }|
|
]])
@ -136,11 +133,9 @@ describe('matchparen', function()
-- oldtest: Test_matchparen_mbyte()
it("works with multibyte chars in 'matchpairs'", function()
local screen = Screen.new(30, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.Cyan },
[2] = { bold = true },
})
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}
screen:attach()
exec([[
@ -152,57 +147,57 @@ describe('matchparen', function()
screen:expect([[
^aaaaaaaa |
bbbbcc |
{0:~ }|*7
{1:~ }|*7
|
]])
feed('$')
screen:expect([[
aaaaaaaa{1:^} |
bbbb{1:}cc |
{0:~ }|*7
aaaaaaaa{100:^} |
bbbb{100:}cc |
{1:~ }|*7
|
]])
feed('j')
screen:expect([[
aaaaaaaa |
bbbbc^c |
{0:~ }|*7
{1:~ }|*7
|
]])
feed('2h')
screen:expect([[
aaaaaaaa{1:} |
bbbb{1:^}cc |
{0:~ }|*7
aaaaaaaa{100:} |
bbbb{100:^}cc |
{1:~ }|*7
|
]])
feed('0')
screen:expect([[
aaaaaaaa |
^bbbbcc |
{0:~ }|*7
{1:~ }|*7
|
]])
feed('kA')
screen:expect([[
aaaaaaaa{1:}^ |
bbbb{1:}cc |
{0:~ }|*7
{2:-- INSERT --} |
aaaaaaaa{100:}^ |
bbbb{100:}cc |
{1:~ }|*7
{5:-- INSERT --} |
]])
feed('<Down>')
screen:expect([[
aaaaaaaa |
bbbbcc^ |
{0:~ }|*7
{2:-- INSERT --} |
{1:~ }|*7
{5:-- INSERT --} |
]])
feed('<C-W>')
screen:expect([[
aaaaaaaa{1:} |
bbbb{1:}^ |
{0:~ }|*7
{2:-- INSERT --} |
aaaaaaaa{100:} |
bbbb{100:}^ |
{1:~ }|*7
{5:-- INSERT --} |
]])
end)
end)

View File

@ -21,16 +21,6 @@ describe('ui/ext_popupmenu', function()
clear()
screen = Screen.new(60, 8)
screen:attach({ rgb = true, ext_popupmenu = true })
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { bold = true },
[3] = { reverse = true },
[4] = { bold = true, reverse = true },
[5] = { bold = true, foreground = Screen.colors.SeaGreen },
[6] = { background = Screen.colors.WebGray },
[7] = { background = Screen.colors.LightMagenta },
[8] = { foreground = Screen.colors.Red },
})
source([[
function! TestComplete() abort
call complete(1, [{'word':'foo', 'abbr':'fo', 'menu':'the foo', 'info':'foo-y', 'kind':'x'}, 'bar', 'spam'])
@ -52,7 +42,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -67,7 +57,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -83,7 +73,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -98,7 +88,7 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
}
end)
@ -110,7 +100,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -125,7 +115,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -140,7 +130,7 @@ describe('ui/ext_popupmenu', function()
|
spam^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -154,7 +144,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
feed('<c-w><C-r>=TestComplete()<CR>')
@ -163,7 +153,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -178,7 +168,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -193,7 +183,7 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -208,7 +198,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -223,7 +213,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -237,7 +227,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
command('set wildmenu')
@ -332,7 +322,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -347,7 +337,7 @@ describe('ui/ext_popupmenu', function()
|
spam^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -362,7 +352,7 @@ describe('ui/ext_popupmenu', function()
|
spam^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -376,7 +366,7 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
feed('<Esc>:sign <Tab>')
@ -440,33 +430,33 @@ describe('ui/ext_popupmenu', function()
screen:expect([[
|
foo^ |
{6:fo x the foo }{1: }|
{7:bar }{1: }|
{7:spam }{1: }|
{12:fo x the foo }{1: }|
{4:bar }{1: }|
{4:spam }{1: }|
{1:~ }|*2
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
feed('<f1>')
screen:expect([[
|
spam^ |
{7:fo x the foo }{1: }|
{7:bar }{1: }|
{6:spam }{1: }|
{4:fo x the foo }{1: }|
{4:bar }{1: }|
{12:spam }{1: }|
{1:~ }|*2
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
feed('<f2>')
screen:expect([[
|
spam^ |
{7:fo x the foo }{1: }|
{7:bar }{1: }|
{7:spam }{1: }|
{4:fo x the foo }{1: }|
{4:bar }{1: }|
{4:spam }{1: }|
{1:~ }|*2
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
feed('<f3>')
@ -474,42 +464,42 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
feed('<Esc>:sign <Tab>')
screen:expect([[
|
bar {6: define } |
{1:~ }{7: jump }{1: }|
{1:~ }{7: list }{1: }|
{1:~ }{7: place }{1: }|
{1:~ }{7: undefine }{1: }|
{1:~ }{7: unplace }{1: }|
bar {12: define } |
{1:~ }{4: jump }{1: }|
{1:~ }{4: list }{1: }|
{1:~ }{4: place }{1: }|
{1:~ }{4: undefine }{1: }|
{1:~ }{4: unplace }{1: }|
:sign define^ |
]])
feed('<f1>')
screen:expect([[
|
bar {7: define } |
{1:~ }{7: jump }{1: }|
{1:~ }{6: list }{1: }|
{1:~ }{7: place }{1: }|
{1:~ }{7: undefine }{1: }|
{1:~ }{7: unplace }{1: }|
bar {4: define } |
{1:~ }{4: jump }{1: }|
{1:~ }{12: list }{1: }|
{1:~ }{4: place }{1: }|
{1:~ }{4: undefine }{1: }|
{1:~ }{4: unplace }{1: }|
:sign list^ |
]])
feed('<f2>')
screen:expect([[
|
bar {7: define } |
{1:~ }{7: jump }{1: }|
{1:~ }{7: list }{1: }|
{1:~ }{7: place }{1: }|
{1:~ }{7: undefine }{1: }|
{1:~ }{7: unplace }{1: }|
bar {4: define } |
{1:~ }{4: jump }{1: }|
{1:~ }{4: list }{1: }|
{1:~ }{4: place }{1: }|
{1:~ }{4: undefine }{1: }|
{1:~ }{4: unplace }{1: }|
:sign ^ |
]])
@ -542,33 +532,33 @@ describe('ui/ext_popupmenu', function()
screen:expect([[
aa bb cc |
aa^ |
{6:aa }{1: }|
{7:bb }{1: }|
{7:cc }{1: }|
{12:aa }{1: }|
{4:bb }{1: }|
{4:cc }{1: }|
{1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 3} |
{5:-- Keyword Local completion (^N^P) }{6:match 1 of 3} |
]])
feed('<f1>')
screen:expect([[
aa bb cc |
cc^ |
{7:aa }{1: }|
{7:bb }{1: }|
{6:cc }{1: }|
{4:aa }{1: }|
{4:bb }{1: }|
{12:cc }{1: }|
{1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{5:match 3 of 3} |
{5:-- Keyword Local completion (^N^P) }{6:match 3 of 3} |
]])
feed('<f2>')
screen:expect([[
aa bb cc |
cc^ |
{7:aa }{1: }|
{7:bb }{1: }|
{7:cc }{1: }|
{4:aa }{1: }|
{4:bb }{1: }|
{4:cc }{1: }|
{1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{8:Back at original} |
{5:-- Keyword Local completion (^N^P) }{19:Back at original} |
]])
feed('<f3>')
@ -576,7 +566,7 @@ describe('ui/ext_popupmenu', function()
aa bb cc |
bb^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]])
end)
@ -619,7 +609,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@ -671,7 +661,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@ -726,7 +716,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@ -740,7 +730,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@ -832,10 +822,10 @@ describe('ui/ext_popupmenu', function()
grid = [[
|
{1:~ }|*3
{4:långfile2 }|
{3:långfile2 }|
|
{1:~ }|*2
{3:långfile1 }|
{2:långfile1 }|
:b långfile1^ |
]],
popupmenu = {
@ -863,7 +853,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -878,7 +868,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
{5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@ -899,9 +889,9 @@ describe('ui/ext_popupmenu', function()
feed('<RightMouse><0,0>')
screen:expect([[
|
{7:^foo } |
{7:bar }{1: }|
{7:baz }{1: }|
{4:^foo } |
{4:bar }{1: }|
{4:baz }{1: }|
{1:~ }|*3
|
]])
@ -3640,37 +3630,36 @@ describe('builtin popupmenu', function()
it(
'cascading highlights for matched text (PmenuMatch, PmenuMatchSel) in cmdline pum',
function()
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Blue1, bold = true },
[2] = {
underline = true,
screen:add_extra_attr_ids {
[100] = {
background = Screen.colors.Grey,
italic = true,
underline = true,
foreground = Screen.colors.White,
background = Screen.colors.Grey,
},
[3] = {
foreground = Screen.colors.Red,
background = Screen.colors.Grey,
[101] = {
strikethrough = true,
underline = true,
foreground = Screen.colors.Grey0,
italic = true,
},
[4] = {
foreground = Screen.colors.Yellow,
background = Screen.colors.Pink,
bold = true,
underline = true,
italic = true,
},
[5] = {
foreground = Screen.colors.Black,
background = Screen.colors.White,
},
[102] = {
strikethrough = true,
foreground = Screen.colors.Red,
italic = true,
underline = true,
background = Screen.colors.Grey,
},
[103] = {
foreground = Screen.colors.Yellow,
italic = true,
bold = true,
underline = true,
italic = true,
strikethrough = true,
background = Screen.colors.Pink,
},
})
}
exec([[
set wildoptions=pum,fuzzy
hi Pmenu guifg=White guibg=Grey gui=underline,italic
@ -3683,8 +3672,8 @@ describe('builtin popupmenu', function()
screen:expect([[
|
{1:~ }|*16
{1:~ }{3: }{5:pl}{3:a}{5:c}{3:e }{1: }|
{1:~ }{2: un}{4:pl}{2:a}{4:c}{2:e }{1: }|
{1:~ }{102: }{101:pl}{102:a}{101:c}{102:e }{1: }|
{1:~ }{100: un}{103:pl}{100:a}{103:c}{100:e }{1: }|
:sign place^ |
]])
end

View File

@ -193,13 +193,6 @@ describe('eval-API', function()
it('are highlighted by vim.vim syntax file', function()
local screen = Screen.new(40, 8)
screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Brown },
[2] = { foreground = Screen.colors.DarkCyan },
[3] = { foreground = Screen.colors.SlateBlue },
[4] = { foreground = Screen.colors.Fuchsia },
[5] = { bold = true, foreground = Screen.colors.Blue },
})
command('set ft=vim')
command('set rtp^=build/runtime/')
@ -210,10 +203,10 @@ describe('eval-API', function()
call not_a_function(42)]])
screen:expect([[
{1:call} {2:bufnr}{3:(}{4:'%'}{3:)} |
{1:call} {2:nvim_input}{3:(}{4:'typing...'}{3:)} |
{1:call} not_a_function{3:(}{4:42}{3:^)} |
{5:~ }|*4
{15:call} {25:bufnr}{16:(}{26:'%'}{16:)} |
{15:call} {25:nvim_input}{16:(}{26:'typing...'}{16:)} |
{15:call} not_a_function{16:(}{26:42}{16:^)} |
{1:~ }|*4
|
]])
end)

View File

@ -189,11 +189,6 @@ describe('uncaught exception', function()
it('multiline exception remains multiline #25350', function()
local screen = Screen.new(80, 11)
screen:set_default_attr_ids({
[1] = { bold = true, reverse = true }, -- MsgSeparator
[2] = { foreground = Screen.colors.White, background = Screen.colors.Red }, -- ErrorMsg
[3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach()
exec_lua([[
function _G.Oops()
@ -203,17 +198,17 @@ describe('uncaught exception', function()
feed(':try\rlua _G.Oops()\rendtry\r')
screen:expect {
grid = [[
{1: }|
{3: }|
:try |
: lua _G.Oops() |
: endtry |
{2:Error detected while processing :} |
{2:E5108: Error executing lua [string "<nvim>"]:2: oops} |
{2:stack traceback:} |
{2: [C]: in function 'error'} |
{2: [string "<nvim>"]:2: in function 'Oops'} |
{2: [string ":lua"]:1: in main chunk} |
{3:Press ENTER or type command to continue}^ |
{9:Error detected while processing :} |
{9:E5108: Error executing lua [string "<nvim>"]:2: oops} |
{9:stack traceback:} |
{9: [C]: in function 'error'} |
{9: [string "<nvim>"]:2: in function 'Oops'} |
{9: [string ":lua"]:1: in main chunk} |
{6:Press ENTER or type command to continue}^ |
]],
}
end)

View File

@ -109,9 +109,6 @@ describe('timers', function()
it('can invoke redraw in blocking getchar() call', function()
local screen = Screen.new(40, 6)
screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
})
api.nvim_buf_set_lines(0, 0, -1, true, { 'ITEM 1', 'ITEM 2' })
source([[
@ -229,7 +226,6 @@ describe('timers', function()
it("doesn't mess up the cmdline", function()
local screen = Screen.new(40, 6)
screen:attach()
screen:set_default_attr_ids({ [0] = { bold = true, foreground = 255 } })
source([[
let g:val = 0
func! MyHandler(timer)
@ -247,7 +243,7 @@ describe('timers', function()
feed(':good')
screen:expect([[
|
{0:~ }|*4
{1:~ }|*4
:good^ |
]])
command('let g:val = 1')