Merge pull request #29014 from bfredl/editortest

refactor(tests): more global highlight definitions
This commit is contained in:
bfredl 2024-05-26 13:32:51 +02:00 committed by GitHub
commit 4f24e1b1d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 319 additions and 353 deletions

View File

@ -276,11 +276,6 @@ describe('fileio', function()
write_file('Xtest-overwrite-forced', 'foobar')
command('set nofixendofline')
local screen = Screen.new(40, 4)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[3] = { bold = true, foreground = Screen.colors.SeaGreen4 },
})
screen:attach()
command('set shortmess-=F')
@ -300,9 +295,9 @@ describe('fileio', function()
-- use async feed_command because nvim basically hangs on the prompt
feed_command('w')
screen:expect([[
{2:WARNING: The file has been changed since}|
{2: reading it!!!} |
{3:Do you really want to write to it (y/n)?}|
{9:WARNING: The file has been changed since}|
{9: reading it!!!} |
{6:Do you really want to write to it (y/n)?}|
^ |
]])

View File

@ -910,11 +910,6 @@ describe('jobs', function()
it('hides cursor and flushes messages before blocking', function()
local screen = Screen.new(50, 6)
screen:set_default_attr_ids({
[0] = { foreground = Screen.colors.Blue, bold = true }, -- NonText
[1] = { bold = true, reverse = true }, -- MsgSeparator
[2] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach()
command([[let g:id = jobstart([v:progpath, '--clean', '--headless'])]])
source([[
@ -928,8 +923,8 @@ describe('jobs', function()
screen:expect {
grid = [[
|
{0:~ }|*2
{1: }|
{1:~ }|*2
{3: }|
aaa |
bbb |
]],
@ -938,11 +933,11 @@ describe('jobs', function()
screen:expect {
grid = [[
|
{1: }|
{3: }|
aaa |
bbb |
ccc |
{2:Press ENTER or type command to continue}^ |
{6:Press ENTER or type command to continue}^ |
]],
}
feed('<CR>')

File diff suppressed because it is too large Load Diff

View File

@ -48,18 +48,14 @@ describe('cmdline', function()
it('redraws statusline when toggling overstrike', function()
local screen = Screen.new(60, 4)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { reverse = true, bold = true }, -- StatusLine
})
screen:attach()
command('set laststatus=2 statusline=%!mode(1)')
feed(':')
screen:expect {
grid = [[
|
{0:~ }|
{1:c }|
{1:~ }|
{3:c }|
:^ |
]],
}
@ -67,8 +63,8 @@ describe('cmdline', function()
screen:expect {
grid = [[
|
{0:~ }|
{1:cr }|
{1:~ }|
{3:cr }|
:^ |
]],
}

View File

@ -180,12 +180,6 @@ describe('insert-mode', function()
it('multi-char mapping updates screen properly #25626', function()
local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, reverse = true }, -- StatusLine
[2] = { reverse = true }, -- StatusLineNC
[3] = { bold = true }, -- ModeMsg
})
screen:attach()
command('vnew')
insert('foo\nfoo\nfoo')
@ -197,10 +191,10 @@ describe('insert-mode', function()
grid = [[
foo |
foo β^ |
foo {0:~ }|
{0:~ }{0:~ }|
{2:[No Name] [+] }{1:[No Name] [+] }|
{3:-- INSERT --} |
foo {1:~ }|
{1:~ }{1:~ }|
{2:[No Name] [+] }{3:[No Name] [+] }|
{5:-- INSERT --} |
]],
}
feed('k')
@ -208,9 +202,9 @@ describe('insert-mode', function()
grid = [[
foo |
foo ^βββ |
foo {0:~ }|
{0:~ }{0:~ }|
{2:[No Name] [+] }{1:[No Name] [+] }|
foo {1:~ }|
{1:~ }{1:~ }|
{2:[No Name] [+] }{3:[No Name] [+] }|
|
]],
}

View File

@ -102,14 +102,9 @@ describe('tabpage', function()
it('switching tabpage after setting laststatus=3 #19591', function()
local screen = Screen.new(40, 8)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { bold = true, reverse = true }, -- StatusLine
[2] = { reverse = true }, -- TabLineFill
[3] = { bold = true }, -- TabLineSel
[4] = { background = Screen.colors.LightGrey, underline = true }, -- TabLine
[5] = { bold = true, foreground = Screen.colors.Magenta },
})
screen:add_extra_attr_ids {
[100] = { bold = true, foreground = Screen.colors.Fuchsia },
}
screen:attach()
command('tabnew')
@ -118,18 +113,18 @@ describe('tabpage', function()
command('tabnext')
feed('<C-G>')
screen:expect([[
{4: [No Name] }{3: [No Name] }{2: }{4:X}|
{24: [No Name] }{5: [No Name] }{2: }{24:X}|
^ |
{0:~ }|*4
{1:[No Name] }|
{1:~ }|*4
{3:[No Name] }|
"[No Name]" --No lines in buffer-- |
]])
command('vnew')
screen:expect([[
{4: [No Name] }{3: }{5:2}{3: [No Name] }{2: }{4:X}|
{24: [No Name] }{5: }{100:2}{5: [No Name] }{2: }{24:X}|
^ |
{0:~ }{0:~ }|*4
{1:[No Name] }|
{1:~ }{1:~ }|*4
{3:[No Name] }|
"[No Name]" --No lines in buffer-- |
]])
end)