tests: don't ignore highlights in various tests

This commit is contained in:
Björn Linse 2016-08-09 15:11:04 +02:00
parent 0a882b4818
commit f282b8ecac
8 changed files with 101 additions and 95 deletions

View File

@ -213,22 +213,22 @@ describe('vim_* functions', function()
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[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},
[2] = {bold = true, foreground = Screen.colors.SeaGreen} [2] = {bold = true, foreground = Screen.colors.SeaGreen}
}) })
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
end) end)
it('can show one line', function() it('can show one line', function()
nvim_async('err_write', 'has bork\n') nvim_async('err_write', 'has bork\n')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:has bork} | {1:has bork} |
]]) ]])
end) end)
@ -236,11 +236,11 @@ describe('vim_* functions', function()
it('shows return prompt when more than &cmdheight lines', function() it('shows return prompt when more than &cmdheight lines', function()
nvim_async('err_write', 'something happened\nvery bad\n') nvim_async('err_write', 'something happened\nvery bad\n')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:something happened} | {1:something happened} |
{1:very bad} | {1:very bad} |
{2:Press ENTER or type command to continue}^ | {2:Press ENTER or type command to continue}^ |
@ -250,9 +250,9 @@ describe('vim_* functions', function()
it('shows return prompt after all lines are shown', function() it('shows return prompt after all lines are shown', function()
nvim_async('err_write', 'FAILURE\nERROR\nEXCEPTION\nTRACEBACK\n') nvim_async('err_write', 'FAILURE\nERROR\nEXCEPTION\nTRACEBACK\n')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:FAILURE} | {1:FAILURE} |
{1:ERROR} | {1:ERROR} |
{1:EXCEPTION} | {1:EXCEPTION} |
@ -267,12 +267,12 @@ describe('vim_* functions', function()
nvim_async('err_write', 'fail\n') nvim_async('err_write', 'fail\n')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:very fail} | {1:very fail} |
]]) ]])
helpers.wait() helpers.wait()
@ -280,11 +280,11 @@ describe('vim_* functions', function()
-- shows up to &cmdheight lines -- shows up to &cmdheight lines
nvim_async('err_write', 'more fail\ntoo fail\n') nvim_async('err_write', 'more fail\ntoo fail\n')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:more fail} | {1:more fail} |
{1:too fail} | {1:too fail} |
{2:Press ENTER or type command to continue}^ | {2:Press ENTER or type command to continue}^ |

View File

@ -72,13 +72,13 @@ describe('execute()', function()
it('silences command run inside', function() it('silences command run inside', function()
local screen = Screen.new(20, 5) local screen = Screen.new(20, 5)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=255}}) screen:set_default_attr_ids( {[0] = {bold=true, foreground=255}} )
feed(':let g:mes = execute("echon 42")<CR>') feed(':let g:mes = execute("echon 42")<CR>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
eq('42', eval('g:mes')) eq('42', eval('g:mes'))

View File

@ -137,7 +137,7 @@ describe('timers', function()
it("doesn't mess up the cmdline", function() it("doesn't mess up the cmdline", function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}}) screen:set_default_attr_ids( {[0] = {bold=true, foreground=255}} )
source([[ source([[
func! MyHandler(timer) func! MyHandler(timer)
echo "evil" echo "evil"
@ -148,10 +148,10 @@ describe('timers', function()
screen:sleep(200) screen:sleep(200)
screen:expect([[ screen:expect([[
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:good^ | :good^ |
]]) ]])
end) end)

View File

@ -9,8 +9,8 @@ describe(":drop", function()
clear() clear()
screen = Screen.new(35, 10) screen = Screen.new(35, 10)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}})
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold = true, reverse = true}, [1] = {bold = true, reverse = true},
[2] = {reverse = true}, [2] = {reverse = true},
[3] = {bold = true}, [3] = {bold = true},
@ -26,13 +26,13 @@ describe(":drop", function()
execute("drop tmp1.vim") execute("drop tmp1.vim")
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:tmp1.vim }| {1:tmp1.vim }|
"tmp1.vim" [New File] | "tmp1.vim" [New File] |
]]) ]])
@ -45,13 +45,13 @@ describe(":drop", function()
execute("drop tmp1") execute("drop tmp1")
screen:expect([[ screen:expect([[
{2:|}^ | {2:|}^ |
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
{2:tmp2 }{1:tmp1 }| {2:tmp2 }{1:tmp1 }|
:drop tmp1 | :drop tmp1 |
]]) ]])
@ -65,13 +65,13 @@ describe(":drop", function()
execute("drop tmp3") execute("drop tmp3")
screen:expect([[ screen:expect([[
^ {2:|} | ^ {2:|} |
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
{1:tmp3 }{2:|}~ | {1:tmp3 }{2:|}{0:~ }|
ABC {2:|}~ | ABC {2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
{2:tmp2 [+] tmp1 }| {2:tmp2 [+] tmp1 }|
"tmp3" [New File] | "tmp3" [New File] |
]]) ]])

View File

@ -248,14 +248,13 @@ describe('packadd', function()
screen = Screen.new(30, 5) screen = Screen.new(30, 5)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = { [1] = {
foreground = Screen.colors.Black, foreground = Screen.colors.Black,
background = Screen.colors.Yellow, background = Screen.colors.Yellow,
}, },
[2] = {bold = true, reverse = true} [2] = {bold = true, reverse = true}
}) })
local NonText = Screen.colors.Blue
screen:set_default_attr_ignore({{}, {bold=true, foreground=NonText}})
execute([[let optdir1 = &packpath . '/pack/mine/opt']]) execute([[let optdir1 = &packpath . '/pack/mine/opt']])
execute([[let optdir2 = &packpath . '/pack/candidate/opt']]) execute([[let optdir2 = &packpath . '/pack/candidate/opt']])
@ -269,32 +268,32 @@ describe('packadd', function()
feed(':packadd <Tab>') feed(':packadd <Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{1:pluginA}{2: pluginB pluginC }| {1:pluginA}{2: pluginB pluginC }|
:packadd pluginA^ | :packadd pluginA^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:pluginA }{1:pluginB}{2: pluginC }| {2:pluginA }{1:pluginB}{2: pluginC }|
:packadd pluginB^ | :packadd pluginB^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:pluginA pluginB }{1:pluginC}{2: }| {2:pluginA pluginB }{1:pluginC}{2: }|
:packadd pluginC^ | :packadd pluginC^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:pluginA pluginB pluginC }| {2:pluginA pluginB pluginC }|
:packadd ^ | :packadd ^ |
]=]) ]=])
@ -316,32 +315,32 @@ describe('packadd', function()
feed(':colorscheme <Tab>') feed(':colorscheme <Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{1:one}{2: three two }| {1:one}{2: three two }|
:colorscheme one^ | :colorscheme one^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:one }{1:three}{2: two }| {2:one }{1:three}{2: two }|
:colorscheme three^ | :colorscheme three^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:one three }{1:two}{2: }| {2:one three }{1:two}{2: }|
:colorscheme two^ | :colorscheme two^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:one three two }| {2:one three two }|
:colorscheme ^ | :colorscheme ^ |
]=]) ]=])

View File

@ -16,7 +16,10 @@ describe('matchparen', function()
reset() reset()
screen = Screen.new(20,5) screen = Screen.new(20,5)
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=255},
[1] = {bold=true},
} )
end) end)
it('uses correct column after i_<Up>. Vim patch 7.4.1296', function() it('uses correct column after i_<Up>. Vim patch 7.4.1296', function()
@ -37,7 +40,7 @@ describe('matchparen', function()
^ | ^ |
} | } |
{1:-- INSERT --} | {1:-- INSERT --} |
]], {[1] = {bold = true}}) ]])
end) end)
end) end)

View File

@ -9,7 +9,11 @@ describe('Signs', function()
clear() clear()
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{}, {bold=true, foreground=255}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=255},
[1] = {background = Screen.colors.Yellow},
[2] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey},
} )
end) end)
after_each(function() after_each(function()
@ -25,19 +29,19 @@ describe('Signs', function()
execute('sign place 2 line=3 name=piet buffer=1') execute('sign place 2 line=3 name=piet buffer=1')
execute('sign place 3 line=1 name=pietx buffer=1') execute('sign place 3 line=1 name=pietx buffer=1')
screen:expect([[ screen:expect([[
>!a | {1:>!}a |
b | {2: }b |
>>c | {1:>>}c |
^ | {2: }^ |
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
:sign place 3 line=1 name=pietx buffer=1 | :sign place 3 line=1 name=pietx buffer=1 |
]]) ]])
end) end)

View File

@ -39,7 +39,7 @@ describe('command line completion', function()
clear() clear()
screen = Screen.new(40, 5) screen = Screen.new(40, 5)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}}) screen:set_default_attr_ids({[1]={bold=true, foreground=Screen.colors.Blue}})
end) end)
after_each(function() after_each(function()
@ -55,9 +55,9 @@ describe('command line completion', function()
feed(':!<tab><bs>') feed(':!<tab><bs>')
screen:expect([[ screen:expect([[
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:!Xtest-functional-viml-compl-dir^ | :!Xtest-functional-viml-compl-dir^ |
]]) ]])
end) end)