Merge pull request #30045 from bfredl/nodefault5

refactor(tests): again yet more global highlight definitions
This commit is contained in:
bfredl 2024-08-14 19:38:49 +02:00 committed by GitHub
commit 32d17cb6d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 139 additions and 231 deletions

View File

@ -103,9 +103,9 @@ describe('oldtests', function()
it('no ml_get error with TextChanged autocommand and delete', function() it('no ml_get error with TextChanged autocommand and delete', function()
local screen = Screen.new(75, 10) local screen = Screen.new(75, 10)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { background = Screen.colors.Cyan }, [100] = { background = Screen.colors.Cyan1 },
}) }
exec([[ exec([[
set noshowcmd noruler scrolloff=0 set noshowcmd noruler scrolloff=0
source test/old/testdir/samples/matchparen.vim source test/old/testdir/samples/matchparen.vim
@ -120,9 +120,9 @@ describe('oldtests', function()
} | } |
const auto &themes = _forPeer->owner().cloudThemes(); | const auto &themes = _forPeer->owner().cloudThemes(); |
const auto theme = themes.themeForEmoji(themeEmoji); | const auto theme = themes.themeForEmoji(themeEmoji); |
if (!theme) {1:{} | if (!theme) {100:{} |
return nonCustom; | return nonCustom; |
{1:^}} | {100:^}} |
353 fewer lines | 353 fewer lines |
]], ]],
} }

View File

@ -259,15 +259,6 @@ describe('autocmd', function()
local screen = Screen.new(50, 10) local screen = Screen.new(50, 10)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { background = Screen.colors.LightMagenta },
[3] = {
background = Screen.colors.LightMagenta,
bold = true,
foreground = Screen.colors.Blue1,
},
})
source([[ source([[
function! Doit() function! Doit()
@ -292,8 +283,8 @@ describe('autocmd', function()
feed(':enew | doautoall User<cr>') feed(':enew | doautoall User<cr>')
screen:expect([[ screen:expect([[
{2:bb }| {4:bb }|
{3:~ }|*4 {11:~ }|*4
{1:~ }|*4 {1:~ }|*4
^:enew | doautoall User | ^:enew | doautoall User |
]]) ]])
@ -318,8 +309,8 @@ describe('autocmd', function()
command('let g:had_value = v:null') command('let g:had_value = v:null')
feed(':doautoall User<cr>') feed(':doautoall User<cr>')
screen:expect([[ screen:expect([[
{2:bb }| {4:bb }|
{3:~ }|*4 {11:~ }|*4
{1:~ }|*4 {1:~ }|*4
^:doautoall User | ^:doautoall User |
]]) ]])
@ -343,11 +334,6 @@ describe('autocmd', function()
it('`aucmd_win` cannot be changed into a normal window #13699', function() it('`aucmd_win` cannot be changed into a normal window #13699', function()
local screen = Screen.new(50, 10) local screen = Screen.new(50, 10)
screen:attach() screen:attach()
screen:set_default_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { reverse = true },
[3] = { bold = true, reverse = true },
}
-- Create specific layout and ensure it's left unchanged. -- Create specific layout and ensure it's left unchanged.
-- Use vim._with on a hidden buffer so aucmd_win is used. -- Use vim._with on a hidden buffer so aucmd_win is used.
@ -513,9 +499,6 @@ describe('autocmd', function()
it(':doautocmd does not warn "No matching autocommands" #10689', function() it(':doautocmd does not warn "No matching autocommands" #10689', function()
local screen = Screen.new(32, 3) local screen = Screen.new(32, 3)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
})
feed(':doautocmd User Foo<cr>') feed(':doautocmd User Foo<cr>')
screen:expect { screen:expect {

View File

@ -61,12 +61,6 @@ describe('cmdline autocommands', function()
clear() clear()
local screen = Screen.new(72, 8) local screen = Screen.new(72, 8)
screen:attach() screen:attach()
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 },
[4] = { bold = true, reverse = true },
})
command("autocmd CmdlineEnter * echoerr 'FAIL'") command("autocmd CmdlineEnter * echoerr 'FAIL'")
command("autocmd CmdlineLeave * echoerr 'very error'") command("autocmd CmdlineLeave * echoerr 'very error'")
@ -74,22 +68,22 @@ describe('cmdline autocommands', function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*3 {1:~ }|*3
{4: }| {3: }|
: | : |
{2:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} | {9:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} |
:^ | :^ |
]]) ]])
feed("put ='lorem ipsum'<cr>") feed("put ='lorem ipsum'<cr>")
screen:expect([[ screen:expect([[
| |
{4: }| {3: }|
: | : |
{2:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} | {9:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} |
:put ='lorem ipsum' | :put ='lorem ipsum' |
{2:CmdlineLeave Autocommands for "*": Vim(echoerr):very error} | {9:CmdlineLeave Autocommands for "*": Vim(echoerr):very error} |
| |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
-- cmdline was still executed -- cmdline was still executed
@ -108,11 +102,11 @@ describe('cmdline autocommands', function()
screen:expect([[ screen:expect([[
| |
lorem ipsum | lorem ipsum |
{4: }| {3: }|
: | : |
{2:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} | {9:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} |
:put ='lorem ipsum' | :put ='lorem ipsum' |
{2:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} | {9:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} |
:put ='lorem ipsum'^ | :put ='lorem ipsum'^ |
]]) ]])
@ -120,37 +114,37 @@ describe('cmdline autocommands', function()
screen:expect([[ screen:expect([[
| |
lorem ipsum | lorem ipsum |
{4: }| {3: }|
: | : |
{2:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} | {9:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} |
:put ='lorem ipsum' | :put ='lorem ipsum' |
{2:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} | {9:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} |
:put ='lorem ipsum^' | :put ='lorem ipsum^' |
]]) ]])
-- edit still works -- edit still works
feed('.') feed('.')
screen:expect([[ screen:expect([[
{4: }| {3: }|
: | : |
{2:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} | {9:CmdlineEnter Autocommands for "*": Vim(echoerr):FAIL} |
:put ='lorem ipsum' | :put ='lorem ipsum' |
{2:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} | {9:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} |
:put ='lorem ipsum.' | :put ='lorem ipsum.' |
{2:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} | {9:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} |
:put ='lorem ipsum.^' | :put ='lorem ipsum.^' |
]]) ]])
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
:put ='lorem ipsum' | :put ='lorem ipsum' |
{2:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} | {9:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} |
:put ='lorem ipsum.' | :put ='lorem ipsum.' |
{2:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} | {9:CmdlineChanged Autocommands for "*": Vim(echoerr):change erreor} |
:put ='lorem ipsum.' | :put ='lorem ipsum.' |
{2:CmdlineLeave Autocommands for "*": Vim(echoerr):very error} | {9:CmdlineLeave Autocommands for "*": Vim(echoerr):very error} |
| |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
-- cmdline was still executed -- cmdline was still executed

View File

@ -43,11 +43,9 @@ describe(':autocmd', function()
it('should not show group information if interrupted', function() it('should not show group information if interrupted', function()
local screen = Screen.new(50, 6) local screen = Screen.new(50, 6)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText [100] = { foreground = Screen.colors.Magenta, bold = true },
[2] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg }
[3] = { bold = true, foreground = Screen.colors.Magenta }, -- Title
})
screen:attach() screen:attach()
exec([[ exec([[
set more set more
@ -73,11 +71,11 @@ describe(':autocmd', function()
feed(':autocmd<CR>') feed(':autocmd<CR>')
screen:expect([[ screen:expect([[
:autocmd | :autocmd |
{3:--- Autocommands ---} | {100:--- Autocommands ---} |
{3:test_1} {3:BufEnter} | {100:test_1} {100:BufEnter} |
A echo 'A' | A echo 'A' |
B echo 'B' | B echo 'B' |
{2:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('q') feed('q')
screen:expect([[ screen:expect([[

View File

@ -510,23 +510,16 @@ describe('v:lua', function()
it('works in func options', function() it('works in func options', function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {background = Screen.colors.WebGray},
[3] = {background = Screen.colors.LightMagenta},
[4] = {bold = true},
[5] = {bold = true, foreground = Screen.colors.SeaGreen4},
})
screen:attach() screen:attach()
api.nvim_set_option_value('omnifunc', 'v:lua.mymod.omni', {}) api.nvim_set_option_value('omnifunc', 'v:lua.mymod.omni', {})
feed('isome st<c-x><c-o>') feed('isome st<c-x><c-o>')
screen:expect{grid=[[ screen:expect{grid=[[
some stuff^ | some stuff^ |
{1:~ }{2: stuff }{1: }| {1:~ }{12: stuff }{1: }|
{1:~ }{3: steam }{1: }| {1:~ }{4: steam }{1: }|
{1:~ }{3: strange things }{1: }| {1:~ }{4: strange things }{1: }|
{1:~ }|*3 {1:~ }|*3
{4:-- Omni completion (^O^N^P) }{5:match 1 of 3} | {5:-- Omni completion (^O^N^P) }{6:match 1 of 3} |
]]} ]]}
api.nvim_set_option_value('operatorfunc', 'v:lua.mymod.noisy', {}) api.nvim_set_option_value('operatorfunc', 'v:lua.mymod.noisy', {})
feed('<Esc>g@g@') feed('<Esc>g@g@')

View File

@ -18,13 +18,6 @@ describe('thread', function()
clear() clear()
screen = Screen.new(50, 10) screen = Screen.new(50, 10)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },
[3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
[5] = { bold = true },
})
end) end)
it('entry func is executed in protected mode', function() it('entry func is executed in protected mode', function()
@ -38,10 +31,10 @@ describe('thread', function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*5 {1:~ }|*5
{2: }| {3: }|
{3:Error in luv thread:} | {9:Error in luv thread:} |
{3:[string "<nvim>"]:2: Error in thread entry func} | {9:[string "<nvim>"]:2: Error in thread entry func} |
{4:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed('<cr>') feed('<cr>')
assert_alive() assert_alive()
@ -65,10 +58,10 @@ describe('thread', function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*5 {1:~ }|*5
{2: }| {3: }|
{3:Error in luv callback, thread:} | {9:Error in luv callback, thread:} |
{3:[string "<nvim>"]:6: Error in thread callback} | {9:[string "<nvim>"]:6: Error in thread callback} |
{4:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed('<cr>') feed('<cr>')
assert_alive() assert_alive()
@ -265,13 +258,6 @@ describe('threadpool', function()
it('with invalid return value', function() it('with invalid return value', function()
local screen = Screen.new(50, 10) local screen = Screen.new(50, 10)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },
[3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
[5] = { bold = true },
})
exec_lua [[ exec_lua [[
local work = vim.uv.new_work(function() return {} end, function() end) local work = vim.uv.new_work(function() return {} end, function() end)
@ -281,10 +267,10 @@ describe('threadpool', function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*5 {1:~ }|*5
{2: }| {3: }|
{3:Error in luv thread:} | {9:Error in luv thread:} |
{3:Error: thread arg not support type 'table' at 1} | {9:Error: thread arg not support type 'table' at 1} |
{4:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
end) end)

View File

@ -540,12 +540,6 @@ describe('lua stdlib', function()
matches('big failure\nvery async', remove_trace(eval('v:errmsg'))) matches('big failure\nvery async', remove_trace(eval('v:errmsg')))
local screen = Screen.new(60, 5) local screen = Screen.new(60, 5)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },
[3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
})
screen:attach() screen:attach()
screen:expect { screen:expect {
grid = [[ grid = [[
@ -564,11 +558,11 @@ describe('lua stdlib', function()
]]) ]])
screen:expect { screen:expect {
grid = [[ grid = [[
{3:stack traceback:} | {9:stack traceback:} |
{3: [C]: in function 'nvim_command'} | {9: [C]: in function 'nvim_command'} |
{3: [string "<nvim>"]:2: in function <[string "<nvim>"]:}| {9: [string "<nvim>"]:2: in function <[string "<nvim>"]:}|
{3:1>} | {9:1>} |
{4:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]], ]],
} }
end) end)
@ -1318,12 +1312,6 @@ describe('lua stdlib', function()
end) end)
local screen = Screen.new(50, 7) local screen = Screen.new(50, 7)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },
[3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
})
screen:attach() screen:attach()
exec_lua([[ exec_lua([[
timer = vim.uv.new_timer() timer = vim.uv.new_timer()
@ -1336,13 +1324,13 @@ describe('lua stdlib', function()
]]) ]])
screen:expect { screen:expect {
grid = [[ grid = [[
{3:[string "<nvim>"]:6: E5560: rpcrequest must not be}| {9:[string "<nvim>"]:6: E5560: rpcrequest must not be}|
{3: called in a lua loop callback} | {9: called in a lua loop callback} |
{3:stack traceback:} | {9:stack traceback:} |
{3: [C]: in function 'rpcrequest'} | {9: [C]: in function 'rpcrequest'} |
{3: [string "<nvim>"]:6: in function <[string }| {9: [string "<nvim>"]:6: in function <[string }|
{3:"<nvim>"]:2>} | {9:"<nvim>"]:2>} |
{4:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]], ]],
} }
feed('<cr>') feed('<cr>')
@ -1995,16 +1983,12 @@ describe('lua stdlib', function()
eq({ 1, 5 }, api.nvim_win_get_cursor(0)) eq({ 1, 5 }, api.nvim_win_get_cursor(0))
local screen = Screen.new(60, 3) local screen = Screen.new(60, 3)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.Yellow },
})
screen:attach() screen:attach()
eq(1, eval('v:hlsearch')) eq(1, eval('v:hlsearch'))
screen:expect { screen:expect {
grid = [[ grid = [[
{1:foo} {1:^foo} {1:foo} | {10:foo} {10:^foo} {10:foo} |
{0:~ }| {1:~ }|
| |
]], ]],
} }
@ -2013,7 +1997,7 @@ describe('lua stdlib', function()
screen:expect { screen:expect {
grid = [[ grid = [[
foo ^foo foo | foo ^foo foo |
{0:~ }| {1:~ }|
| |
]], ]],
} }
@ -2021,8 +2005,8 @@ describe('lua stdlib', function()
eq(1, eval('v:hlsearch')) eq(1, eval('v:hlsearch'))
screen:expect { screen:expect {
grid = [[ grid = [[
{1:foo} {1:^foo} {1:foo} | {10:foo} {10:^foo} {10:foo} |
{0:~ }| {1:~ }|
| |
]], ]],
} }
@ -3542,15 +3526,11 @@ describe('lua stdlib', function()
it('vim.notify_once', function() it('vim.notify_once', function()
local screen = Screen.new(60, 5) local screen = Screen.new(60, 5)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { foreground = Screen.colors.Red },
})
screen:attach() screen:attach()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*3 {1:~ }|*3
| |
]], ]],
} }
@ -3558,15 +3538,15 @@ describe('lua stdlib', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*3 {1:~ }|*3
{1:I'll only tell you this once...} | {19:I'll only tell you this once...} |
]], ]],
} }
feed('<C-l>') feed('<C-l>')
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*3 {1:~ }|*3
| |
]], ]],
} }
@ -3743,10 +3723,6 @@ describe('lua stdlib', function()
it('updates ruler if cursor moved', function() it('updates ruler if cursor moved', function()
-- Fixed for win_execute in vim-patch:8.1.2124, but should've applied to nvim_win_call too! -- Fixed for win_execute in vim-patch:8.1.2124, but should've applied to nvim_win_call too!
local screen = Screen.new(30, 5) local screen = Screen.new(30, 5)
screen:set_default_attr_ids {
[1] = { reverse = true },
[2] = { bold = true, reverse = true },
}
screen:attach() screen:attach()
exec_lua [[ exec_lua [[
_G.api = vim.api _G.api = vim.api
@ -3761,9 +3737,9 @@ describe('lua stdlib', function()
]] ]]
screen:expect [[ screen:expect [[
19 | 19 |
{1:[No Name] [+] 20,1 3%}|
^19 |
{2:[No Name] [+] 20,1 3%}| {2:[No Name] [+] 20,1 3%}|
^19 |
{3:[No Name] [+] 20,1 3%}|
| |
]] ]]
exec_lua [[ exec_lua [[
@ -3772,9 +3748,9 @@ describe('lua stdlib', function()
]] ]]
screen:expect [[ screen:expect [[
99 | 99 |
{1:[No Name] [+] 100,1 19%}| {2:[No Name] [+] 100,1 19%}|
^19 | ^19 |
{2:[No Name] [+] 20,1 3%}| {3:[No Name] [+] 20,1 3%}|
| |
]] ]]
end) end)
@ -3890,13 +3866,6 @@ describe('lua stdlib', function()
it('vim.lua_omnifunc', function() it('vim.lua_omnifunc', function()
local screen = Screen.new(60, 5) local screen = Screen.new(60, 5)
screen:set_default_attr_ids {
[1] = { foreground = Screen.colors.Blue1, bold = true },
[2] = { background = Screen.colors.WebGray },
[3] = { background = Screen.colors.LightMagenta },
[4] = { bold = true },
[5] = { foreground = Screen.colors.SeaGreen, bold = true },
}
screen:attach() screen:attach()
command [[ set omnifunc=v:lua.vim.lua_omnifunc ]] command [[ set omnifunc=v:lua.vim.lua_omnifunc ]]
@ -3906,10 +3875,10 @@ describe('lua stdlib', function()
screen:expect { screen:expect {
grid = [[ grid = [[
vim.inspect^ | vim.inspect^ |
{1:~ }{2: inspect }{1: }| {1:~ }{12: inspect }{1: }|
{1:~ }{3: inspect_pos }{1: }| {1:~ }{4: inspect_pos }{1: }|
{1:~ }| {1:~ }|
{4:-- Omni completion (^O^N^P) }{5:match 1 of 2} | {5:-- Omni completion (^O^N^P) }{6:match 1 of 2} |
]], ]],
} }
end) end)

View File

@ -94,12 +94,6 @@ describe('clipboard', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(72, 4) screen = Screen.new(72, 4)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[2] = { bold = true, foreground = Screen.colors.SeaGreen4 },
[3] = { bold = true, reverse = true },
})
screen:attach() screen:attach()
end) end)
@ -114,13 +108,13 @@ describe('clipboard', function()
feed('"+yl') feed('"+yl')
screen:expect([[ screen:expect([[
^a | ^a |
{0:~ }|*2 {1:~ }|*2
clipboard: No provider. Try ":checkhealth" or ":h clipboard". | clipboard: No provider. Try ":checkhealth" or ":h clipboard". |
]]) ]])
feed('"+p') feed('"+p')
screen:expect([[ screen:expect([[
a^a | a^a |
{0:~ }|*2 {1:~ }|*2
clipboard: No provider. Try ":checkhealth" or ":h clipboard". | clipboard: No provider. Try ":checkhealth" or ":h clipboard". |
]]) ]])
end) end)
@ -132,19 +126,19 @@ describe('clipboard', function()
feed('yl') feed('yl')
screen:expect([[ screen:expect([[
^a | ^a |
{0:~ }|*2 {1:~ }|*2
clipboard: No provider. Try ":checkhealth" or ":h clipboard". | clipboard: No provider. Try ":checkhealth" or ":h clipboard". |
]]) ]])
feed(':<CR>') feed(':<CR>')
screen:expect([[ screen:expect([[
^a | ^a |
{0:~ }|*2 {1:~ }|*2
: | : |
]]) ]])
feed('p') feed('p')
screen:expect([[ screen:expect([[
a^a | a^a |
{0:~ }|*2 {1:~ }|*2
: | : |
]]) ]])
end) end)
@ -154,7 +148,7 @@ describe('clipboard', function()
feed_command('redir @+> | :silent echo system("cat CONTRIBUTING.md") | redir END') feed_command('redir @+> | :silent echo system("cat CONTRIBUTING.md") | redir END')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
clipboard: No provider. Try ":checkhealth" or ":h clipboard". | clipboard: No provider. Try ":checkhealth" or ":h clipboard". |
]]) ]])
end) end)
@ -166,8 +160,8 @@ describe('clipboard', function()
grid = [[ grid = [[
{3: }| {3: }|
clipboard: No provider. Try ":checkhealth" or ":h clipboard". | clipboard: No provider. Try ":checkhealth" or ":h clipboard". |
{1:E492: Not an editor command: bogus_cmd | redir END} | {9:E492: Not an editor command: bogus_cmd | redir END} |
{2:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]], ]],
} }
end) end)
@ -182,7 +176,7 @@ describe('clipboard', function()
feed_command('let @+="foo"') feed_command('let @+="foo"')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
clipboard: No provider. Try ":checkhealth" or ":h clipboard". | clipboard: No provider. Try ":checkhealth" or ":h clipboard". |
]]) ]])
end) end)
@ -325,15 +319,11 @@ describe('clipboard (with fake clipboard.vim)', function()
it('`:redir @+>|bogus_cmd|redir END` must not recurse #7184', function() it('`:redir @+>|bogus_cmd|redir END` must not recurse #7184', function()
local screen = Screen.new(72, 4) local screen = Screen.new(72, 4)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
})
feed_command('redir @+> | bogus_cmd | redir END') feed_command('redir @+> | bogus_cmd | redir END')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
{1:E492: Not an editor command: bogus_cmd | redir END} | {9:E492: Not an editor command: bogus_cmd | redir END} |
]]) ]])
end) end)
@ -719,9 +709,6 @@ describe('clipboard (with fake clipboard.vim)', function()
feed_command('set mouse=a') feed_command('set mouse=a')
local screen = Screen.new(30, 5) local screen = Screen.new(30, 5)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
})
screen:attach() screen:attach()
insert([[ insert([[
the source the source
@ -731,7 +718,7 @@ describe('clipboard (with fake clipboard.vim)', function()
screen:expect([[ screen:expect([[
the ^source | the ^source |
a target | a target |
{0:~ }|*2 {1:~ }|*2
| |
]]) ]])

View File

@ -16,30 +16,24 @@ describe("'wildmenu'", function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(25, 5) screen = Screen.new(25, 5)
screen:set_default_attr_ids { screen:add_extra_attr_ids {
[1] = { foreground = Screen.colors.Blue, bold = true }, [100] = { background = Screen.colors.Yellow1, foreground = Screen.colors.Black },
[2] = { reverse = true },
[3] = { bold = true, reverse = true },
[5] = { bold = true },
[31] = { foreground = Screen.colors.Grey0, background = Screen.colors.Yellow },
} }
screen:attach() screen:attach()
end) end)
-- oldtest: Test_wildmenu_screendump() -- oldtest: Test_wildmenu_screendump()
it('works', function() it('works', function()
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText [100] = { background = Screen.colors.Yellow1, foreground = Screen.colors.Black },
[1] = { foreground = Screen.colors.Black, background = Screen.colors.Yellow }, -- WildMenu }
[2] = { bold = true, reverse = true }, -- StatusLine
})
-- Test simple wildmenu -- Test simple wildmenu
feed(':sign <Tab>') feed(':sign <Tab>')
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
{1:define}{2: jump list > }| {100:define}{3: jump list > }|
:sign define^ | :sign define^ |
]], ]],
} }
@ -48,8 +42,8 @@ describe("'wildmenu'", function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
{2:define }{1:jump}{2: list > }| {3:define }{100:jump}{3: list > }|
:sign jump^ | :sign jump^ |
]], ]],
} }
@ -58,8 +52,8 @@ describe("'wildmenu'", function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
{2:define jump }{1:list}{2: > }| {3:define jump }{100:list}{3: > }|
:sign list^ | :sign list^ |
]], ]],
} }
@ -69,8 +63,8 @@ describe("'wildmenu'", function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
{2:define jump list > }| {3:define jump list > }|
:sign ^ | :sign ^ |
]], ]],
} }
@ -80,7 +74,7 @@ describe("'wildmenu'", function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*3 {1:~ }|*3
:sign ^ | :sign ^ |
]], ]],
} }
@ -92,8 +86,8 @@ describe("'wildmenu'", function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
{1:define}{2: jump list > }| {100:define}{3: jump list > }|
:sign define^ | :sign define^ |
]], ]],
} }
@ -104,7 +98,7 @@ describe("'wildmenu'", function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*3 {1:~ }|*3
| |
]], ]],
} }
@ -115,7 +109,7 @@ describe("'wildmenu'", function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*2 {1:~ }|*2
{31:define}{3: jump list > }| {100:define}{3: jump list > }|
:sign define^ | :sign define^ |
]]) ]])
feed('<C-E>') feed('<C-E>')
@ -131,7 +125,7 @@ describe("'wildmenu'", function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*2 {1:~ }|*2
{31:define}{3: jump list > }| {100:define}{3: jump list > }|
:sign define^ | :sign define^ |
]]) ]])
feed('<tab><C-Y>') feed('<tab><C-Y>')
@ -148,7 +142,7 @@ describe("'wildmenu'", function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*2 {1:~ }|*2
{31:define}{3: jump list > }| {100:define}{3: jump list > }|
:sign define^ | :sign define^ |
]]) ]])
end) end)
@ -162,7 +156,7 @@ describe("'wildmenu'", function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*2 {1:~ }|*2
{31:define}{3: jump list > }| {100:define}{3: jump list > }|
:sign define^ | :sign define^ |
]]) ]])
feed('<space>') feed('<space>')
@ -188,7 +182,7 @@ describe("'wildmenu'", function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*2 {1:~ }|*2
{31:!}{3: # & < = > @ > }| {100:!}{3: # & < = > @ > }|
:!^ | :!^ |
]]) ]])
end) end)
@ -199,13 +193,17 @@ describe("'wildmenu'", function()
feed((':terminal "%s" REP 5000 !terminal_output!<cr>'):format(testprg('shell-test'))) feed((':terminal "%s" REP 5000 !terminal_output!<cr>'):format(testprg('shell-test')))
feed('G') -- Follow :terminal output. feed('G') -- Follow :terminal output.
feed([[:sign <Tab>]]) -- Invoke wildmenu. feed([[:sign <Tab>]]) -- Invoke wildmenu.
screen:set_default_attr_ids { screen:add_extra_attr_ids {
[31] = { foreground = Screen.colors.Black, background = Screen.colors.Yellow }, [100] = { foreground = Screen.colors.Black, background = Screen.colors.Yellow },
[32] = { bold = true, foreground = Screen.colors.White, background = Screen.colors.DarkGreen }, [101] = {
bold = true,
foreground = Screen.colors.White,
background = Screen.colors.DarkGreen,
},
} }
-- NB: in earlier versions terminal output was redrawn during cmdline mode. -- NB: in earlier versions terminal output was redrawn during cmdline mode.
-- For now just assert that the screen remains unchanged. -- For now just assert that the screen remains unchanged.
screen:expect { any = '{31:define}{32: jump list > }|\n:sign define^ |' } screen:expect { any = '{100:define}{101: jump list > }|\n:sign define^ |' }
screen:expect_unchanged() screen:expect_unchanged()
-- cmdline CTRL-D display should also be preserved. -- cmdline CTRL-D display should also be preserved.
@ -236,7 +234,7 @@ describe("'wildmenu'", function()
grid = [[ grid = [[
| |
{1:~ }|*2 {1:~ }|*2
{31:define}{3: jump list > }| {100:define}{3: jump list > }|
:sign define^ | :sign define^ |
]], ]],
} }
@ -263,13 +261,17 @@ describe("'wildmenu'", function()
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
feed([[:<Tab>]]) -- Invoke wildmenu. feed([[:<Tab>]]) -- Invoke wildmenu.
screen:set_default_attr_ids { screen:add_extra_attr_ids {
[31] = { foreground = Screen.colors.Black, background = Screen.colors.Yellow }, [100] = { foreground = Screen.colors.Black, background = Screen.colors.Yellow },
[32] = { bold = true, foreground = Screen.colors.White, background = Screen.colors.DarkGreen }, [101] = {
bold = true,
foreground = Screen.colors.White,
background = Screen.colors.DarkGreen,
},
} }
-- Check only the last 2 lines, because the shell output is -- Check only the last 2 lines, because the shell output is
-- system-dependent. -- system-dependent.
screen:expect { any = '{31:!}{32: # & < = > @ > }|\n:!^' } screen:expect { any = '{100:!}{101: # & < = > @ > }|\n:!^' }
-- Because this test verifies a _lack_ of activity, we must wait the full timeout. -- Because this test verifies a _lack_ of activity, we must wait the full timeout.
-- So make it reasonable. -- So make it reasonable.
screen:expect_unchanged(false, 1000) screen:expect_unchanged(false, 1000)
@ -298,7 +300,7 @@ describe("'wildmenu'", function()
{3: }| {3: }|
:set wildm | :set wildm |
wildmenu wildmode | wildmenu wildmode |
{31:wildmenu}{3: wildmode }| {100:wildmenu}{3: wildmode }|
:set wildmenu^ | :set wildmenu^ |
]]) ]])
feed('<Esc>') feed('<Esc>')
@ -424,10 +426,8 @@ describe("'wildmenu'", function()
end) end)
it('works with c_CTRL_Z standard mapping', function() it('works with c_CTRL_Z standard mapping', function()
screen:set_default_attr_ids { screen:add_extra_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue1 }, [100] = { background = Screen.colors.Yellow1, foreground = Screen.colors.Black },
[2] = { foreground = Screen.colors.Grey0, background = Screen.colors.Yellow },
[3] = { bold = true, reverse = true },
} }
-- Wildcharm? where we are going we aint't no need no wildcharm. -- Wildcharm? where we are going we aint't no need no wildcharm.
@ -444,7 +444,7 @@ describe("'wildmenu'", function()
grid = [[ grid = [[
| |
{1:~ }|*2 {1:~ }|*2
{2:case}{3: clear cluster > }| {100:case}{3: clear cluster > }|
:syntax case^ | :syntax case^ |
]], ]],
} }
@ -489,11 +489,9 @@ describe('command line completion', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(40, 5) screen = Screen.new(40, 5)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue1 }, [100] = { background = Screen.colors.Yellow1, foreground = Screen.colors.Black },
[2] = { foreground = Screen.colors.Grey0, background = Screen.colors.Yellow }, }
[3] = { bold = true, reverse = true },
})
screen:attach() screen:attach()
end) end)
after_each(function() after_each(function()
@ -521,7 +519,7 @@ describe('command line completion', function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*2 {1:~ }|*2
{2:XTEST_1}{3: XTEST_2 }| {100:XTEST_1}{3: XTEST_2 }|
:!echo $XTEST_1^ | :!echo $XTEST_1^ |
]]) ]])
end) end)
@ -537,7 +535,7 @@ describe('command line completion', function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*2 {1:~ }|*2
{2:XTEST_1AaあB}{3: XTEST_2 }| {100:XTEST_1AaあB}{3: XTEST_2 }|
:!echo $XTEST_1AaあB^ | :!echo $XTEST_1AaあB^ |
]]) ]])
end) end)