tests: don't ignore highlights in highlight_spec

This commit is contained in:
Björn Linse
2016-08-09 14:18:13 +02:00
parent 7b29fdd200
commit cc657951a9

View File

@@ -27,10 +27,11 @@ describe('manual syntax highlight', function()
clear() clear()
screen = Screen.new(20,5) screen = Screen.new(20,5)
screen:attach() screen:attach()
--ignore highligting of ~-lines
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
--syntax highlight for vimcscripts "echo" --syntax highlight for vimcscripts "echo"
screen:set_default_attr_ids( {[1] = {bold=true, foreground=Screen.colors.Brown}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold=true, foreground=Screen.colors.Brown}
} )
end) end)
after_each(function() after_each(function()
@@ -53,9 +54,9 @@ describe('manual syntax highlight', function()
execute('bp') execute('bp')
screen:expect([[ screen:expect([[
{1:^echo} 1 | {1:^echo} 1 |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
<f 1 --100%-- col 1 | <f 1 --100%-- col 1 |
]]) ]])
end) end)
@@ -75,9 +76,9 @@ describe('manual syntax highlight', function()
execute('bp') execute('bp')
screen:expect([[ screen:expect([[
{1:^echo} 1 | {1:^echo} 1 |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
<ht.tmp.vim" 1L, 7C | <ht.tmp.vim" 1L, 7C |
]]) ]])
end) end)
@@ -93,8 +94,6 @@ describe('Default highlight groups', function()
clear() clear()
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
--ignore highligting of ~-lines
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
end) end)
after_each(function() after_each(function()
@@ -103,23 +102,24 @@ describe('Default highlight groups', function()
it('window status bar', function() it('window status bar', function()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {reverse = true, bold = true}, -- StatusLine [1] = {reverse = true, bold = true}, -- StatusLine
[2] = {reverse = true} -- StatusLineNC [2] = {reverse = true} -- StatusLineNC
}) })
execute('sp', 'vsp', 'vsp') execute('sp', 'vsp', 'vsp')
screen:expect([[ screen:expect([[
^ {2:|} {2:|} | ^ {2:|} {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{1:[No Name] }{2:[No Name] [No Name] }| {1:[No Name] }{2:[No Name] [No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
@@ -127,17 +127,17 @@ describe('Default highlight groups', function()
feed('<c-w>j') feed('<c-w>j')
screen:expect([[ screen:expect([[
{2:|} {2:|} | {2:|} {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{2:[No Name] [No Name] [No Name] }| {2:[No Name] [No Name] [No Name] }|
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:[No Name] }| {1:[No Name] }|
| |
]]) ]])
@@ -147,51 +147,51 @@ describe('Default highlight groups', function()
feed('<c-w>k<c-w>l') feed('<c-w>k<c-w>l')
screen:expect([[ screen:expect([[
{2:|}^ {2:|} | {2:|}^ {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{2:[No Name] }{1:[No Name] }{2:[No Name] }| {2:[No Name] }{1:[No Name] }{2:[No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
feed('<c-w>l') feed('<c-w>l')
screen:expect([[ screen:expect([[
{2:|} {2:|}^ | {2:|} {2:|}^ |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{2:[No Name] [No Name] }{1:[No Name] }| {2:[No Name] [No Name] }{1:[No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
feed('<c-w>h<c-w>h') feed('<c-w>h<c-w>h')
screen:expect([[ screen:expect([[
^ {2:|} {2:|} | ^ {2:|} {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{1:[No Name] }{2:[No Name] [No Name] }| {1:[No Name] }{2:[No Name] [No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
@@ -201,20 +201,21 @@ describe('Default highlight groups', function()
feed('i') feed('i')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:-- INSERT --} | {1:-- INSERT --} |
]], {[1] = {bold = true}}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold = true}})
end) end)
it('end of file markers', function() it('end of file markers', function()
@@ -239,21 +240,22 @@ describe('Default highlight groups', function()
it('"wait return" text', function() it('"wait return" text', function()
feed(':ls<cr>') feed(':ls<cr>')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:ls | :ls |
1 %a "[No Name]" line 1 | 1 %a "[No Name]" line 1 |
{1:Press ENTER or type command to continue}^ | {1:Press ENTER or type command to continue}^ |
]], {[1] = {bold = true, foreground = Screen.colors.SeaGreen}}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold = true, foreground = Screen.colors.SeaGreen}})
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end) end)
it('can be cleared and linked to other highlight groups', function() it('can be cleared and linked to other highlight groups', function()
@@ -261,40 +263,42 @@ describe('Default highlight groups', function()
feed('i') feed('i')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | -- INSERT -- |
]], {}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold=true}})
feed('<esc>') feed('<esc>')
execute('highlight CustomHLGroup guifg=red guibg=green') execute('highlight CustomHLGroup guifg=red guibg=green')
execute('highlight link ModeMsg CustomHLGroup') execute('highlight link ModeMsg CustomHLGroup')
feed('i') feed('i')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:-- INSERT --} | {1:-- INSERT --} |
]], {[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
end) end)
it('can be cleared by assigning NONE', function() it('can be cleared by assigning NONE', function()
execute('syn keyword TmpKeyword neovim') execute('syn keyword TmpKeyword neovim')
@@ -302,40 +306,41 @@ describe('Default highlight groups', function()
insert('neovim') insert('neovim')
screen:expect([[ screen:expect([[
{1:neovi^m} | {1:neovi^m} |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], { ]], {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.White, background = Screen.colors.Red} [1] = {foreground = Screen.colors.White, background = Screen.colors.Red}
}) })
execute("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE" execute("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
.. " gui=NONE guifg=NONE guibg=NONE guisp=NONE") .. " gui=NONE guifg=NONE guibg=NONE guisp=NONE")
screen:expect([[ screen:expect([[
neovi^m | neovi^m |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], {}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
end) end)
end) end)
@@ -346,10 +351,6 @@ describe('guisp (special/undercurl)', function()
clear() clear()
screen = Screen.new(25,10) screen = Screen.new(25,10)
screen:attach() screen:attach()
screen:set_default_attr_ignore({
[1] = {bold = true, foreground = Screen.colors.Blue},
[2] = {bold = true}
})
end) end)
it('can be set and is applied like foreground or background', function() it('can be set and is applied like foreground or background', function()
@@ -384,14 +385,16 @@ describe('guisp (special/undercurl)', function()
{4:specialwithfg} | {4:specialwithfg} |
| |
{1:neovim} tabbed^ | {1:neovim} tabbed^ |
~ | {0:~ }|
-- INSERT -- | {5:-- INSERT --} |
]],{ ]],{
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red, [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red,
special = Screen.colors.Red}, special = Screen.colors.Red},
[2] = {special = Screen.colors.Red}, [2] = {special = Screen.colors.Red},
[3] = {special = Screen.colors.Red, background = Screen.colors.Yellow}, [3] = {special = Screen.colors.Red, background = Screen.colors.Yellow},
[4] = {foreground = Screen.colors.Red, special = Screen.colors.Red}, [4] = {foreground = Screen.colors.Red, special = Screen.colors.Red},
[5] = {bold=true},
}) })
end) end)
@@ -411,48 +414,50 @@ describe("'cursorline' with 'listchars'", function()
end) end)
it("'cursorline' and 'cursorcolumn'", function() it("'cursorline' and 'cursorcolumn'", function()
screen:set_default_attr_ids({[1] = {background=Screen.colors.Grey90}}) screen:set_default_attr_ids({
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} ) [0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background=Screen.colors.Grey90}
})
execute('highlight clear ModeMsg') execute('highlight clear ModeMsg')
execute('set cursorline') execute('set cursorline')
feed('i') feed('i')
screen:expect([[ screen:expect([[
{1:^ }| {1:^ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | -- INSERT -- |
]]) ]])
feed('abcdefg<cr>kkasdf') feed('abcdefg<cr>kkasdf')
screen:expect([[ screen:expect([[
abcdefg | abcdefg |
{1:kkasdf^ }| {1:kkasdf^ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | -- INSERT -- |
]]) ]])
feed('<esc>') feed('<esc>')
screen:expect([[ screen:expect([[
abcdefg | abcdefg |
{1:kkasd^f }| {1:kkasd^f }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
execute('set nocursorline') execute('set nocursorline')
screen:expect([[ screen:expect([[
abcdefg | abcdefg |
kkasd^f | kkasd^f |
~ | {0:~ }|
~ | {0:~ }|
:set nocursorline | :set nocursorline |
]]) ]])
feed('k') feed('k')
screen:expect([[ screen:expect([[
abcde^fg | abcde^fg |
kkasdf | kkasdf |
~ | {0:~ }|
~ | {0:~ }|
:set nocursorline | :set nocursorline |
]]) ]])
feed('jjji<cr><cr><cr><esc>') feed('jjji<cr><cr><cr><esc>')