tests: remove deprecated hl_colors

This commit is contained in:
Björn Linse
2016-08-09 13:19:31 +02:00
parent 884b37fd2a
commit 9c4a94f964
4 changed files with 45 additions and 76 deletions

View File

@@ -8,30 +8,21 @@ describe('Buffer highlighting', function()
local screen local screen
local curbuf local curbuf
local hl_colors = {
NonText = Screen.colors.Blue,
Question = Screen.colors.SeaGreen,
String = Screen.colors.Fuchsia,
Statement = Screen.colors.Brown,
Special = Screen.colors.SlateBlue,
Identifier = Screen.colors.DarkCyan
}
before_each(function() before_each(function()
clear() clear()
execute("syntax on") execute("syntax on")
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{bold=true, foreground=hl_colors.NonText}} ) screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {foreground = hl_colors.String}, [1] = {foreground = Screen.colors.Fuchsia}, -- String
[2] = {foreground = hl_colors.Statement, bold = true}, [2] = {foreground = Screen.colors.Brown, bold = true}, -- Statement
[3] = {foreground = hl_colors.Special}, [3] = {foreground = Screen.colors.SlateBlue}, -- Special
[4] = {bold = true, foreground = hl_colors.Special}, [4] = {bold = true, foreground = Screen.colors.SlateBlue},
[5] = {foreground = hl_colors.Identifier}, [5] = {foreground = Screen.colors.DarkCyan}, -- Identifier
[6] = {bold = true}, [6] = {bold = true},
[7] = {underline = true, bold = true, foreground = hl_colors.Special}, [7] = {underline = true, bold = true, foreground = Screen.colors.SlateBlue},
[8] = {foreground = hl_colors.Special, underline = true} [8] = {foreground = Screen.colors.SlateBlue, underline = true}
}) })
curbuf = request('vim_get_current_buffer') curbuf = request('vim_get_current_buffer')
end) end)

View File

@@ -89,17 +89,12 @@ describe('Default highlight groups', function()
-- command -- command
local screen local screen
local hlgroup_colors = {
NonText = Screen.colors.Blue,
Question = Screen.colors.SeaGreen
}
before_each(function() before_each(function()
clear() clear()
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
--ignore highligting of ~-lines --ignore highligting of ~-lines
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} ) screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
end) end)
after_each(function() after_each(function()
@@ -238,7 +233,7 @@ describe('Default highlight groups', function()
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
| |
]], {[1] = {bold = true, foreground = hlgroup_colors.NonText}}) ]], {[1] = {bold = true, foreground = Screen.colors.Blue}})
end) end)
it('"wait return" text', function() it('"wait return" text', function()
@@ -258,7 +253,7 @@ describe('Default highlight groups', function()
: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 = hlgroup_colors.Question}}) ]], {[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()
@@ -405,13 +400,6 @@ end)
describe("'cursorline' with 'listchars'", function() describe("'cursorline' with 'listchars'", function()
local screen local screen
local hlgroup_colors = {
NonText = Screen.colors.Blue,
Cursorline = Screen.colors.Grey90,
SpecialKey = Screen.colors.Red,
Visual = Screen.colors.LightGrey,
}
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(20,5) screen = Screen.new(20,5)
@@ -423,8 +411,8 @@ describe("'cursorline' with 'listchars'", function()
end) end)
it("'cursorline' and 'cursorcolumn'", function() it("'cursorline' and 'cursorcolumn'", function()
screen:set_default_attr_ids({[1] = {background=hlgroup_colors.Cursorline}}) screen:set_default_attr_ids({[1] = {background=Screen.colors.Grey90}})
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} ) screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
execute('highlight clear ModeMsg') execute('highlight clear ModeMsg')
execute('set cursorline') execute('set cursorline')
feed('i') feed('i')
@@ -497,22 +485,22 @@ describe("'cursorline' with 'listchars'", function()
it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function() it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {background=hlgroup_colors.Cursorline}, [1] = {background=Screen.colors.Grey90},
[2] = { [2] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
}, },
[3] = { [3] = {
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[4] = { [4] = {
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[5] = { [5] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
}, },
}) })
execute('highlight clear ModeMsg') execute('highlight clear ModeMsg')
@@ -581,33 +569,33 @@ describe("'cursorline' with 'listchars'", function()
it("'listchar' in visual mode", function() it("'listchar' in visual mode", function()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {background=hlgroup_colors.Cursorline}, [1] = {background=Screen.colors.Grey90},
[2] = { [2] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
}, },
[3] = { [3] = {
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[4] = { [4] = {
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[5] = { [5] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
}, },
[6] = { [6] = {
background=hlgroup_colors.Visual, background=Screen.colors.LightGrey,
}, },
[7] = { [7] = {
background=hlgroup_colors.Visual, background=Screen.colors.LightGrey,
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
}, },
[8] = { [8] = {
background=hlgroup_colors.Visual, background=Screen.colors.LightGrey,
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
}) })

View File

@@ -7,11 +7,6 @@ local eq, funcs = helpers.eq, helpers.funcs
describe('Mouse input', function() describe('Mouse input', function()
local screen local screen
local hlgroup_colors = {
NonText = Screen.colors.Blue,
Visual = Screen.colors.LightGrey
}
before_each(function() before_each(function()
clear() clear()
meths.set_option('mouse', 'a') meths.set_option('mouse', 'a')
@@ -22,15 +17,15 @@ describe('Mouse input', function()
screen = Screen.new(25, 5) screen = Screen.new(25, 5)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {background = hlgroup_colors.Visual}, [1] = {background = Screen.colors.LightGrey},
[2] = {bold = true}, [2] = {bold = true},
[3] = { [3] = {
foreground = hlgroup_colors.NonText, foreground = Screen.colors.Blue,
background = hlgroup_colors.Visual, background = Screen.colors.LightGrey,
bold = true, bold = true,
}, },
}) })
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} ) screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
feed('itesting<cr>mouse<cr>support and selection<esc>') feed('itesting<cr>mouse<cr>support and selection<esc>')
screen:expect([[ screen:expect([[
testing | testing |
@@ -409,7 +404,7 @@ describe('Mouse input', function()
]]) ]])
screen:try_resize(53, 14) screen:try_resize(53, 14)
execute('sp', 'vsp') execute('sp', 'vsp')
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}, screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue},
{reverse=true}, {bold=true, reverse=true}} ) {reverse=true}, {bold=true, reverse=true}} )
screen:expect([[ screen:expect([[
lines |lines | lines |lines |

View File

@@ -6,23 +6,18 @@ local execute = helpers.execute
describe('search highlighting', function() describe('search highlighting', function()
local screen local screen
local colors = Screen.colors local colors = Screen.colors
local hl_colors = {
NonText = colors.Blue,
Search = colors.Yellow,
Message = colors.Red,
}
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(40, 7) screen = Screen.new(40, 7)
screen:attach() screen:attach()
--ignore highligting of ~-lines --ignore highligting of ~-lines
screen:set_default_attr_ignore( {{bold=true, foreground=colors.Blue}} )
screen:set_default_attr_ids( { screen:set_default_attr_ids( {
[1] = {background = hl_colors.Search}, [1] = {background = colors.Yellow}, -- Search
[2] = {reverse = true}, [2] = {reverse = true},
[3] = {foreground = hl_colors.Message}, [3] = {foreground = colors.Red}, -- Message
}) })
screen:set_default_attr_ignore( {{bold=true, foreground=hl_colors.NonText}} )
end) end)
it('is disabled by ":set nohlsearch"', function() it('is disabled by ":set nohlsearch"', function()
@@ -250,8 +245,8 @@ describe('search highlighting', function()
~ | ~ |
~ | ~ |
{3:search hit BOTTOM, continuing at TOP} | {3:search hit BOTTOM, continuing at TOP} |
]], {[1] = {background = hl_colors.Search}, [2] = {reverse = true}, ]], {[1] = {background = colors.Yellow}, [2] = {reverse = true},
[3] = {foreground = hl_colors.Message}, [4] = {bold = true, background = [3] = {foreground = colors.Red}, [4] = {bold = true, background =
colors.Green}, [5] = {italic = true, background = colors.Magenta}}) colors.Green}, [5] = {italic = true, background = colors.Magenta}})
execute("call clearmatches()") execute("call clearmatches()")
@@ -276,9 +271,9 @@ describe('search highlighting', function()
~ | ~ |
~ | ~ |
:syntax keyword MyGroup special | :syntax keyword MyGroup special |
]], {[1] = {background = hl_colors.Search}, [2] = {reverse = true}, ]], {[1] = {background = colors.Yellow}, [2] = {reverse = true},
[3] = {foreground = hl_colors.Message}, [4] = {bold = true, [3] = {foreground = colors.Red}, [4] = {bold = true,
background = colors.Green}, [5] = {bold = true, background = hl_colors.Search}}) background = colors.Green}, [5] = {bold = true, background = colors.Yellow}})
end) end)
end) end)