mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
refactor(tests): use more global highlight definitions
This commit is contained in:
@@ -13,21 +13,10 @@ local eq = t.eq
|
||||
local is_os = t.is_os
|
||||
local api = n.api
|
||||
|
||||
-- TODO(bfredl): make Screen.new(cols, rows, {opts}) just work already
|
||||
local function new_screen(opt)
|
||||
local screen = Screen.new(25, 5)
|
||||
screen:attach(opt)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { bold = true, foreground = Screen.colors.Blue1 },
|
||||
[2] = { reverse = true },
|
||||
[3] = { bold = true, reverse = true },
|
||||
[4] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
|
||||
[5] = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
||||
[6] = { foreground = Screen.colors.Magenta },
|
||||
[7] = { bold = true, foreground = Screen.colors.Brown },
|
||||
[8] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
|
||||
[9] = { bold = true },
|
||||
[10] = { background = Screen.colors.Yellow1 },
|
||||
})
|
||||
return screen
|
||||
end
|
||||
|
||||
@@ -189,7 +178,7 @@ local function test_cmdline(linegrid)
|
||||
},
|
||||
{
|
||||
firstc = '=',
|
||||
content = { { '1', 6 }, { '+', 7 }, { '2', 6 } },
|
||||
content = { { '1', 26 }, { '+', 15 }, { '2', 26 } },
|
||||
pos = 3,
|
||||
},
|
||||
}
|
||||
@@ -503,29 +492,24 @@ local function test_cmdline(linegrid)
|
||||
map <f5> :let x = input({'prompt':'>','highlight':'RainBowParens'})<cr>
|
||||
"map <f5> :let x = input({'prompt':'>'})<cr>
|
||||
]])
|
||||
screen:set_default_attr_ids({
|
||||
RBP1 = { background = Screen.colors.Red },
|
||||
RBP2 = { background = Screen.colors.Yellow },
|
||||
EOB = { bold = true, foreground = Screen.colors.Blue1 },
|
||||
})
|
||||
feed('<f5>(a(b)a)')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
^ |
|
||||
{EOB:~ }|*3
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = {
|
||||
{
|
||||
prompt = '>',
|
||||
content = {
|
||||
{ '(', 'RBP1' },
|
||||
{ '(', 30 },
|
||||
{ 'a' },
|
||||
{ '(', 'RBP2' },
|
||||
{ '(', 10 },
|
||||
{ 'b' },
|
||||
{ ')', 'RBP2' },
|
||||
{ ')', 10 },
|
||||
{ 'a' },
|
||||
{ ')', 'RBP1' },
|
||||
{ ')', 30 },
|
||||
},
|
||||
pos = 7,
|
||||
},
|
||||
@@ -929,17 +913,17 @@ describe('cmdline redraw', function()
|
||||
|
|
||||
{1:~ }|*3
|
||||
{2:[No Name] }|
|
||||
{1::}^a{8:bc} |
|
||||
{1::}^a{17:bc} |
|
||||
{1:~ }|*2
|
||||
{3:[Command Line] }|
|
||||
{9:-- VISUAL --} |
|
||||
{5:-- VISUAL --} |
|
||||
]])
|
||||
feed('<C-C>')
|
||||
screen:expect([[
|
||||
|
|
||||
{1:~ }|*3
|
||||
{2:[No Name] }|
|
||||
{1::}a{8:bc} |
|
||||
{1::}a{17:bc} |
|
||||
{1:~ }|*2
|
||||
{3:[Command Line] }|
|
||||
:^abc |
|
||||
@@ -1093,61 +1077,61 @@ describe('statusline is redrawn on entering cmdline', function()
|
||||
feed(':echoerr doesnotexist<cr>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
{9:c1 }|
|
||||
{5:c1 }|
|
||||
|
|
||||
{3:c1 }|
|
||||
|
|
||||
{1:~ }|*5
|
||||
{3: }|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{5:inue}^ |
|
||||
{9:E121: Undefined variable: doesnotex}|
|
||||
{9:ist} |
|
||||
{6:Press ENTER or type command to cont}|
|
||||
{6:inue}^ |
|
||||
]],
|
||||
}
|
||||
feed(':echoerr doesnotexist<cr>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
{9:c2 }|
|
||||
{5:c2 }|
|
||||
|
|
||||
{3:c2 }|
|
||||
|
|
||||
{1:~ }|*2
|
||||
{3: }|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{5:inue}^ |
|
||||
{9:E121: Undefined variable: doesnotex}|
|
||||
{9:ist} |
|
||||
{6:Press ENTER or type command to cont}|
|
||||
{9:E121: Undefined variable: doesnotex}|
|
||||
{9:ist} |
|
||||
{6:Press ENTER or type command to cont}|
|
||||
{6:inue}^ |
|
||||
]],
|
||||
}
|
||||
|
||||
feed(':echoerr doesnotexist<cr>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
{9:c3 }|
|
||||
{5:c3 }|
|
||||
|
|
||||
{3:c3 }|
|
||||
{3: }|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{5:inue}^ |
|
||||
{9:E121: Undefined variable: doesnotex}|
|
||||
{9:ist} |
|
||||
{6:Press ENTER or type command to cont}|
|
||||
{9:E121: Undefined variable: doesnotex}|
|
||||
{9:ist} |
|
||||
{6:Press ENTER or type command to cont}|
|
||||
{9:E121: Undefined variable: doesnotex}|
|
||||
{9:ist} |
|
||||
{6:Press ENTER or type command to cont}|
|
||||
{6:inue}^ |
|
||||
]],
|
||||
}
|
||||
|
||||
feed('<cr>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
{9:n3 }|
|
||||
{5:n3 }|
|
||||
^ |
|
||||
{3:n3 }|
|
||||
|
|
||||
@@ -1202,11 +1186,6 @@ end)
|
||||
it('tabline is not redrawn in Ex mode #24122', function()
|
||||
clear()
|
||||
local screen = Screen.new(60, 5)
|
||||
screen:set_default_attr_ids({
|
||||
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
||||
[1] = { bold = true, reverse = true }, -- MsgSeparator
|
||||
[2] = { reverse = true }, -- TabLineFill
|
||||
})
|
||||
screen:attach()
|
||||
|
||||
exec([[
|
||||
@@ -1224,7 +1203,7 @@ it('tabline is not redrawn in Ex mode #24122', function()
|
||||
grid = [[
|
||||
{2:foo }|
|
||||
|
|
||||
{1: }|
|
||||
{3: }|
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:^ |
|
||||
]],
|
||||
@@ -1233,7 +1212,7 @@ it('tabline is not redrawn in Ex mode #24122', function()
|
||||
feed('echo 1<CR>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
{1: }|
|
||||
{3: }|
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:echo 1 |
|
||||
1 |
|
||||
|
Reference in New Issue
Block a user