mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tests: introduce screen:expect{...} form
This commit is contained in:
parent
03978a0f29
commit
3d88287e30
@ -417,7 +417,7 @@ describe('jobs', function()
|
|||||||
\ })
|
\ })
|
||||||
]])
|
]])
|
||||||
|
|
||||||
screen:expect("{2:E120: Using <SID> not in a script context: s:OnEvent}",nil,nil,nil,true)
|
screen:expect{any="{2:E120: Using <SID> not in a script context: s:OnEvent}"}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('does not repeat output with slow output handlers', function()
|
it('does not repeat output with slow output handlers', function()
|
||||||
|
@ -43,7 +43,7 @@ describe("CTRL-C (mapped)", function()
|
|||||||
feed(":global/^/p<CR>")
|
feed(":global/^/p<CR>")
|
||||||
screen:sleep(ms)
|
screen:sleep(ms)
|
||||||
feed("<C-C>")
|
feed("<C-C>")
|
||||||
screen:expect([[Interrupt]], nil, nil, nil, true)
|
screen:expect{any="Interrupt"}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The test is time-sensitive. Try different sleep values.
|
-- The test is time-sensitive. Try different sleep values.
|
||||||
|
@ -207,18 +207,18 @@ describe('terminal buffer', function()
|
|||||||
feed_command('terminal')
|
feed_command('terminal')
|
||||||
feed('<c-\\><c-n>')
|
feed('<c-\\><c-n>')
|
||||||
feed_command('confirm bdelete')
|
feed_command('confirm bdelete')
|
||||||
screen:expect('Close "term://', nil, true, nil, true)
|
screen:expect{any='Close "term://', attr_ignore=true}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('with &confirm', function()
|
it('with &confirm', function()
|
||||||
feed_command('terminal')
|
feed_command('terminal')
|
||||||
feed('<c-\\><c-n>')
|
feed('<c-\\><c-n>')
|
||||||
feed_command('bdelete')
|
feed_command('bdelete')
|
||||||
screen:expect('E89', nil, true, nil, true)
|
screen:expect{any='E89', attr_ignore=true}
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
eq('terminal', eval('&buftype'))
|
eq('terminal', eval('&buftype'))
|
||||||
feed_command('set confirm | bdelete')
|
feed_command('set confirm | bdelete')
|
||||||
screen:expect('Close "term://', nil, true, nil, true)
|
screen:expect{any='Close "term://', attr_ignore=true}
|
||||||
feed('y')
|
feed('y')
|
||||||
neq('terminal', eval('&buftype'))
|
neq('terminal', eval('&buftype'))
|
||||||
end)
|
end)
|
||||||
@ -242,7 +242,7 @@ describe('No heap-buffer-overflow when using', function()
|
|||||||
feed('$')
|
feed('$')
|
||||||
-- Let termopen() modify the buffer
|
-- Let termopen() modify the buffer
|
||||||
feed_command('call termopen("echo")')
|
feed_command('call termopen("echo")')
|
||||||
wait()
|
eq(2, eval('1+1')) -- check nvim still running
|
||||||
feed_command('bdelete!')
|
feed_command('bdelete!')
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -54,7 +54,7 @@ describe(':terminal', function()
|
|||||||
else
|
else
|
||||||
feed_command([[terminal printf '\e[6n'; sleep 0.5 ]])
|
feed_command([[terminal printf '\e[6n'; sleep 0.5 ]])
|
||||||
end
|
end
|
||||||
screen:expect('%^%[%[1;1R', nil, nil, nil, true)
|
screen:expect{any='%^%[%[1;1R'}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("in normal-mode :split does not move cursor", function()
|
it("in normal-mode :split does not move cursor", function()
|
||||||
|
@ -408,7 +408,7 @@ describe("'scrollback' option", function()
|
|||||||
else
|
else
|
||||||
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
|
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
|
||||||
end
|
end
|
||||||
screen:expect('line30 ', nil, nil, nil, true)
|
screen:expect{any='line30 '}
|
||||||
retry(nil, nil, function() expect_lines(7) end)
|
retry(nil, nil, function() expect_lines(7) end)
|
||||||
|
|
||||||
screen:detach()
|
screen:detach()
|
||||||
@ -426,7 +426,7 @@ describe("'scrollback' option", function()
|
|||||||
curbufmeths.set_option('scrollback', 200)
|
curbufmeths.set_option('scrollback', 200)
|
||||||
|
|
||||||
-- Wait for prompt.
|
-- Wait for prompt.
|
||||||
screen:expect('$', nil, nil, nil, true)
|
screen:expect{any='$'}
|
||||||
|
|
||||||
wait()
|
wait()
|
||||||
if iswin() then
|
if iswin() then
|
||||||
@ -435,7 +435,7 @@ describe("'scrollback' option", function()
|
|||||||
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
|
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
|
||||||
end
|
end
|
||||||
|
|
||||||
screen:expect('line30 ', nil, nil, nil, true)
|
screen:expect{any='line30 '}
|
||||||
|
|
||||||
retry(nil, nil, function() expect_lines(33, 2) end)
|
retry(nil, nil, function() expect_lines(33, 2) end)
|
||||||
curbufmeths.set_option('scrollback', 10)
|
curbufmeths.set_option('scrollback', 10)
|
||||||
@ -452,7 +452,7 @@ describe("'scrollback' option", function()
|
|||||||
feed_data('for i in $(seq 1 40); do echo "line$i"; done\n')
|
feed_data('for i in $(seq 1 40); do echo "line$i"; done\n')
|
||||||
end
|
end
|
||||||
|
|
||||||
screen:expect('line40 ', nil, nil, nil, true)
|
screen:expect{any='line40 '}
|
||||||
|
|
||||||
retry(nil, nil, function() expect_lines(58) end)
|
retry(nil, nil, function() expect_lines(58) end)
|
||||||
-- Verify off-screen state
|
-- Verify off-screen state
|
||||||
|
@ -400,7 +400,7 @@ describe('tui FocusGained/FocusLost', function()
|
|||||||
-- Exit cmdline-mode. Redraws from timers/events are blocked during
|
-- Exit cmdline-mode. Redraws from timers/events are blocked during
|
||||||
-- cmdline-mode, so the buffer won't be updated until we exit cmdline-mode.
|
-- cmdline-mode, so the buffer won't be updated until we exit cmdline-mode.
|
||||||
feed_data('\n')
|
feed_data('\n')
|
||||||
screen:expect('lost'..(' '):rep(46)..'\ngained', nil, nil, nil, true)
|
screen:expect{any='lost'..(' '):rep(46)..'\ngained'}
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -740,7 +740,7 @@ describe("tui 'term' option", function()
|
|||||||
screen.timeout = 250 -- We want screen:expect() to fail quickly.
|
screen.timeout = 250 -- We want screen:expect() to fail quickly.
|
||||||
retry(nil, 2 * full_timeout, function() -- Wait for TUI thread to set 'term'.
|
retry(nil, 2 * full_timeout, function() -- Wait for TUI thread to set 'term'.
|
||||||
feed_data(":echo 'term='.(&term)\n")
|
feed_data(":echo 'term='.(&term)\n")
|
||||||
screen:expect('term='..term_expected, nil, nil, nil, true)
|
screen:expect{any='term='..term_expected}
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,23 +1,16 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local ok = helpers.ok
|
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
|
|
||||||
describe('external cmdline', function()
|
local function test_cmdline(newgrid)
|
||||||
local screen
|
local screen
|
||||||
local last_level = 0
|
|
||||||
local cmdline = {}
|
|
||||||
local block = nil
|
|
||||||
local wild_items = nil
|
|
||||||
local wild_selected = nil
|
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
cmdline, block = {}, nil
|
|
||||||
screen = Screen.new(25, 5)
|
screen = Screen.new(25, 5)
|
||||||
screen:attach({rgb=true, ext_cmdline=true})
|
screen:attach({rgb=true, ext_cmdline=true, ext_newgrid=newgrid})
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
||||||
[2] = {reverse = true},
|
[2] = {reverse = true},
|
||||||
@ -25,142 +18,73 @@ describe('external cmdline', function()
|
|||||||
[4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
[4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
||||||
[5] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
[5] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
})
|
})
|
||||||
screen:set_on_event_handler(function(name, data)
|
|
||||||
if name == "cmdline_show" then
|
|
||||||
local content, pos, firstc, prompt, indent, level = unpack(data)
|
|
||||||
ok(level > 0)
|
|
||||||
for _,item in ipairs(content) do
|
|
||||||
item[1] = screen:get_hl(item[1])
|
|
||||||
end
|
|
||||||
cmdline[level] = {content=content, pos=pos, firstc=firstc,
|
|
||||||
prompt=prompt, indent=indent}
|
|
||||||
last_level = level
|
|
||||||
elseif name == "cmdline_hide" then
|
|
||||||
local level = data[1]
|
|
||||||
cmdline[level] = nil
|
|
||||||
elseif name == "cmdline_special_char" then
|
|
||||||
local char, shift, level = unpack(data)
|
|
||||||
cmdline[level].special = {char, shift}
|
|
||||||
elseif name == "cmdline_pos" then
|
|
||||||
local pos, level = unpack(data)
|
|
||||||
cmdline[level].pos = pos
|
|
||||||
elseif name == "cmdline_block_show" then
|
|
||||||
block = data[1]
|
|
||||||
elseif name == "cmdline_block_append" then
|
|
||||||
block[#block+1] = data[1]
|
|
||||||
elseif name == "cmdline_block_hide" then
|
|
||||||
block = nil
|
|
||||||
elseif name == "wildmenu_show" then
|
|
||||||
wild_items = data[1]
|
|
||||||
elseif name == "wildmenu_select" then
|
|
||||||
wild_selected = data[1]
|
|
||||||
elseif name == "wildmenu_hide" then
|
|
||||||
wild_items, wild_selected = nil, nil
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
screen:detach()
|
screen:detach()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function expect_cmdline(level, expected)
|
|
||||||
local attr_ids = screen._default_attr_ids
|
|
||||||
local attr_ignore = screen._default_attr_ignore
|
|
||||||
local actual = ''
|
|
||||||
for _, chunk in ipairs(cmdline[level] and cmdline[level].content or {}) do
|
|
||||||
local attrs, text = chunk[1], chunk[2]
|
|
||||||
if screen:_equal_attrs(attrs, {}) then
|
|
||||||
actual = actual..text
|
|
||||||
else
|
|
||||||
local attr_id = screen:_get_attr_id(attr_ids, attr_ignore, attrs)
|
|
||||||
actual = actual..'{' .. attr_id .. ':' .. text .. '}'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
eq(expected, actual)
|
|
||||||
end
|
|
||||||
|
|
||||||
it('works', function()
|
it('works', function()
|
||||||
feed(':')
|
feed(':')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq(1, last_level)
|
|
||||||
--print(require('inspect')(cmdline))
|
|
||||||
eq({{
|
|
||||||
content = { { {}, "" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{""}},
|
||||||
pos = 0,
|
pos = 0,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('sign')
|
feed('sign')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sign" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sign"}},
|
||||||
pos = 4,
|
pos = 4,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<Left>')
|
feed('<Left>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sign" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sign"}},
|
||||||
pos = 3,
|
pos = 3,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<bs>')
|
feed('<bs>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sin" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sin"}},
|
||||||
pos = 2,
|
pos = 2,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq({}, cmdline)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("redraws statusline on entering", function()
|
describe("redraws statusline on entering", function()
|
||||||
@ -170,28 +94,32 @@ describe('external cmdline', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('from normal mode', function()
|
it('from normal mode', function()
|
||||||
|
screen:expect{grid=[[
|
||||||
|
^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{3:n }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
|
||||||
feed(':')
|
feed(':')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{3:c }|
|
{3:c }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{""}},
|
||||||
pos = 0,
|
pos = 0,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('but not with scrolled messages', function()
|
it('but not with scrolled messages', function()
|
||||||
screen:try_resize(50,10)
|
screen:try_resize(50,10)
|
||||||
feed(':echoerr doesnotexist<cr>')
|
feed(':echoerr doesnotexist<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -202,9 +130,9 @@ describe('external cmdline', function()
|
|||||||
{4:E121: Undefined variable: doesnotexist} |
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
{4:E15: Invalid expression: doesnotexist} |
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
{5:Press ENTER or type command to continue}^ |
|
{5:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]]}
|
||||||
feed(':echoerr doesnotexist<cr>')
|
feed(':echoerr doesnotexist<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -215,10 +143,10 @@ describe('external cmdline', function()
|
|||||||
{4:E121: Undefined variable: doesnotexist} |
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
{4:E15: Invalid expression: doesnotexist} |
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
{5:Press ENTER or type command to continue}^ |
|
{5:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]]}
|
||||||
|
|
||||||
feed(':echoerr doesnotexist<cr>')
|
feed(':echoerr doesnotexist<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{3: }|
|
{3: }|
|
||||||
@ -229,10 +157,10 @@ describe('external cmdline', function()
|
|||||||
{4:E121: Undefined variable: doesnotexist} |
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
{4:E15: Invalid expression: doesnotexist} |
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
{5:Press ENTER or type command to continue}^ |
|
{5:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]]}
|
||||||
|
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -243,372 +171,314 @@ describe('external cmdline', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{3:n }|
|
{3:n }|
|
||||||
|
|
|
|
||||||
]])
|
]]}
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("works with input()", function()
|
it("works with input()", function()
|
||||||
feed(':call input("input", "default")<cr>')
|
feed(':call input("input", "default")<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
prompt = "input",
|
||||||
content = { { {}, "default" } },
|
content = {{"default"}},
|
||||||
firstc = "",
|
|
||||||
indent = 0,
|
|
||||||
pos = 7,
|
pos = 7,
|
||||||
prompt = "input"
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq({}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("works with special chars and nested cmdline", function()
|
it("works with special chars and nested cmdline", function()
|
||||||
feed(':xx<c-r>')
|
feed(':xx<c-r>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "xx" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"xx"}},
|
||||||
pos = 2,
|
pos = 2,
|
||||||
prompt = "",
|
|
||||||
special = {'"', true},
|
special = {'"', true},
|
||||||
}}, cmdline)
|
}}}
|
||||||
end)
|
|
||||||
|
|
||||||
feed('=')
|
feed('=')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "xx" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"xx"}},
|
||||||
pos = 2,
|
pos = 2,
|
||||||
prompt = "",
|
|
||||||
special = {'"', true},
|
special = {'"', true},
|
||||||
}, {
|
}, {
|
||||||
content = { { {}, "" } },
|
|
||||||
firstc = "=",
|
firstc = "=",
|
||||||
indent = 0,
|
content = {{""}},
|
||||||
pos = 0,
|
pos = 0,
|
||||||
prompt = "",
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('1+2')
|
feed('1+2')
|
||||||
local expectation = {{
|
local expectation = {{
|
||||||
content = { { {}, "xx" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"xx"}},
|
||||||
pos = 2,
|
pos = 2,
|
||||||
prompt = "",
|
|
||||||
special = {'"', true},
|
special = {'"', true},
|
||||||
}, {
|
}, {
|
||||||
content = {
|
|
||||||
{ {}, "1" },
|
|
||||||
{ {}, "+" },
|
|
||||||
{ {}, "2" },
|
|
||||||
},
|
|
||||||
firstc = "=",
|
firstc = "=",
|
||||||
indent = 0,
|
content = {{"1"}, {"+"}, {"2"}},
|
||||||
pos = 3,
|
pos = 3,
|
||||||
prompt = "",
|
|
||||||
}}
|
}}
|
||||||
screen:expect([[
|
|
||||||
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline=expectation}
|
||||||
eq(expectation, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- erase information, so we check if it is retransmitted
|
-- erase information, so we check if it is retransmitted
|
||||||
cmdline = {}
|
-- TODO(bfredl): when we add a flag to screen:expect{}
|
||||||
|
-- to explicitly check redraw!, it should also do this
|
||||||
|
screen.cmdline = {}
|
||||||
command("redraw!")
|
command("redraw!")
|
||||||
-- redraw! forgets cursor position. Be OK with that, as UI should indicate
|
screen:expect{grid=[[
|
||||||
-- focus is at external cmdline anyway.
|
|
||||||
screen:expect([[
|
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline=expectation}
|
||||||
eq(expectation, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "xx3" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"xx3"}},
|
||||||
pos = 3,
|
pos = 3,
|
||||||
prompt = "",
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<esc>')
|
feed('<esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq({}, cmdline)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("works with function definitions", function()
|
it("works with function definitions", function()
|
||||||
feed(':function Foo()<cr>')
|
feed(':function Foo()<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "" } },
|
|
||||||
firstc = ":",
|
|
||||||
indent = 2,
|
indent = 2,
|
||||||
|
firstc = ":",
|
||||||
|
content = {{""}},
|
||||||
pos = 0,
|
pos = 0,
|
||||||
prompt = "",
|
}}, cmdline_block = {
|
||||||
}}, cmdline)
|
{{'function Foo()'}},
|
||||||
eq({ { { {}, 'function Foo()'} } }, block)
|
}}
|
||||||
end)
|
|
||||||
|
|
||||||
feed('line1<cr>')
|
feed('line1<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({ { { {}, 'function Foo()'} },
|
indent = 2,
|
||||||
{ { {}, ' line1'} } }, block)
|
firstc = ":",
|
||||||
end)
|
content = {{""}},
|
||||||
|
pos = 0,
|
||||||
|
}}, cmdline_block = {
|
||||||
|
{{'function Foo()'}},
|
||||||
|
{{' line1'}},
|
||||||
|
}}
|
||||||
|
|
||||||
block = {}
|
screen.cmdline_block = {}
|
||||||
command("redraw!")
|
command("redraw!")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({ { { {}, 'function Foo()'} },
|
indent = 2,
|
||||||
{ { {}, ' line1'} } }, block)
|
firstc = ":",
|
||||||
end)
|
content = {{""}},
|
||||||
|
pos = 0,
|
||||||
|
}}, cmdline_block = {
|
||||||
|
{{'function Foo()'}},
|
||||||
|
{{' line1'}},
|
||||||
|
}}
|
||||||
|
|
||||||
feed('endfunction<cr>')
|
feed('endfunction<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq(nil, block)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Try once more, to check buffer is reinitialized. #8007
|
-- Try once more, to check buffer is reinitialized. #8007
|
||||||
feed(':function Bar()<cr>')
|
feed(':function Bar()<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "" } },
|
|
||||||
firstc = ":",
|
|
||||||
indent = 2,
|
indent = 2,
|
||||||
|
firstc = ":",
|
||||||
|
content = {{""}},
|
||||||
pos = 0,
|
pos = 0,
|
||||||
prompt = "",
|
}}, cmdline_block = {
|
||||||
}}, cmdline)
|
{{'function Bar()'}},
|
||||||
eq({ { { {}, 'function Bar()'} } }, block)
|
}}
|
||||||
end)
|
|
||||||
|
|
||||||
feed('endfunction<cr>')
|
feed('endfunction<cr>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq(nil, block)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("works with cmdline window", function()
|
it("works with cmdline window", function()
|
||||||
feed(':make')
|
feed(':make')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "make" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"make"}},
|
||||||
pos = 4,
|
pos = 4,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<c-f>')
|
feed('<c-f>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{2:[No Name] }|
|
{2:[No Name] }|
|
||||||
{1::}make^ |
|
{1::}make^ |
|
||||||
{3:[Command Line] }|
|
{3:[Command Line] }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq({}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- nested cmdline
|
-- nested cmdline
|
||||||
feed(':yank')
|
feed(':yank')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{2:[No Name] }|
|
{2:[No Name] }|
|
||||||
{1::}make^ |
|
{1::}make^ |
|
||||||
{3:[Command Line] }|
|
{3:[Command Line] }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={nil, {
|
||||||
eq({nil, {
|
|
||||||
content = { { {}, "yank" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"yank"}},
|
||||||
pos = 4,
|
pos = 4,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
cmdline = {}
|
screen.cmdline = {}
|
||||||
command("redraw!")
|
command("redraw!")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{2:[No Name] }|
|
{2:[No Name] }|
|
||||||
{1::}make^ |
|
{1::}make^ |
|
||||||
{3:[Command Line] }|
|
{3:[Command Line] }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={nil, {
|
||||||
eq({nil, {
|
|
||||||
content = { { {}, "yank" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"yank"}},
|
||||||
pos = 4,
|
pos = 4,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed("<c-c>")
|
feed("<c-c>")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{2:[No Name] }|
|
{2:[No Name] }|
|
||||||
{1::}make^ |
|
{1::}make^ |
|
||||||
{3:[Command Line] }|
|
{3:[Command Line] }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq({}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed("<c-c>")
|
feed("<c-c>")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{2:[No Name] }|
|
{2:[No Name] }|
|
||||||
{1::}make^ |
|
{1::}make^ |
|
||||||
{3:[Command Line] }|
|
{3:[Command Line] }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "make" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"make"}},
|
||||||
pos = 4,
|
pos = 4,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
|
|
||||||
cmdline = {}
|
screen.cmdline = {}
|
||||||
command("redraw!")
|
command("redraw!")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "make" } },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"make"}},
|
||||||
pos = 4,
|
pos = 4,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with inputsecret()', function()
|
it('works with inputsecret()', function()
|
||||||
feed(":call inputsecret('secret:')<cr>abc123")
|
feed(":call inputsecret('secret:')<cr>abc123")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
prompt = "secret:",
|
||||||
content = { { {}, "******" } },
|
content = {{"******"}},
|
||||||
firstc = "",
|
|
||||||
indent = 0,
|
|
||||||
pos = 6,
|
pos = 6,
|
||||||
prompt = "secret:"
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with highlighted cmdline', function()
|
it('works with highlighted cmdline', function()
|
||||||
@ -648,15 +518,18 @@ describe('external cmdline', function()
|
|||||||
PE={bold = true, foreground = Screen.colors.SeaGreen4}
|
PE={bold = true, foreground = Screen.colors.SeaGreen4}
|
||||||
})
|
})
|
||||||
feed('<f5>(a(b)a)')
|
feed('<f5>(a(b)a)')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
expect_cmdline(1, '{RBP1:(}a{RBP2:(}b{RBP2:)}a{RBP1:)}')
|
prompt = '>',
|
||||||
end)
|
content = {{'(', 'RBP1'}, {'a'}, {'(', 'RBP2'}, {'b'},
|
||||||
|
{ ')', 'RBP2'}, {'a'}, {')', 'RBP1'}},
|
||||||
|
pos = 7,
|
||||||
|
}}}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works together with ext_wildmenu', function()
|
it('works together with ext_wildmenu', function()
|
||||||
@ -674,98 +547,73 @@ describe('external cmdline', function()
|
|||||||
screen:set_option('ext_wildmenu', true)
|
screen:set_option('ext_wildmenu', true)
|
||||||
feed(':sign <tab>')
|
feed(':sign <tab>')
|
||||||
|
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sign define"} },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sign define"}},
|
||||||
pos = 11,
|
pos = 11,
|
||||||
prompt = ""
|
}}, wildmenu_items=expected, wildmenu_pos=0}
|
||||||
}}, cmdline)
|
|
||||||
eq(expected, wild_items)
|
|
||||||
eq(0, wild_selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<tab>')
|
feed('<tab>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sign jump"} },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sign jump"}},
|
||||||
pos = 9,
|
pos = 9,
|
||||||
prompt = ""
|
}}, wildmenu_items=expected, wildmenu_pos=1}
|
||||||
}}, cmdline)
|
|
||||||
eq(expected, wild_items)
|
|
||||||
eq(1, wild_selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<left><left>')
|
feed('<left><left>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sign "} },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sign "}},
|
||||||
pos = 5,
|
pos = 5,
|
||||||
prompt = ""
|
}}, wildmenu_items=expected, wildmenu_pos=-1}
|
||||||
}}, cmdline)
|
|
||||||
eq(expected, wild_items)
|
|
||||||
eq(-1, wild_selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<right>')
|
feed('<right>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sign define"} },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sign define"}},
|
||||||
pos = 11,
|
pos = 11,
|
||||||
prompt = ""
|
}}, wildmenu_items=expected, wildmenu_pos=0}
|
||||||
}}, cmdline)
|
|
||||||
eq(expected, wild_items)
|
|
||||||
eq(0, wild_selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('a')
|
feed('a')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], cmdline={{
|
||||||
eq({{
|
|
||||||
content = { { {}, "sign definea"} },
|
|
||||||
firstc = ":",
|
firstc = ":",
|
||||||
indent = 0,
|
content = {{"sign definea"}},
|
||||||
pos = 12,
|
pos = 12,
|
||||||
prompt = ""
|
}}}
|
||||||
}}, cmdline)
|
|
||||||
eq(nil, wild_items)
|
|
||||||
eq(nil, wild_selected)
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- the representation of cmdline and cmdline_block contents changed with ext_newgrid
|
||||||
|
-- (which uses indexed highlights) so make sure to test both
|
||||||
|
describe('ui/ext_cmdline', function() test_cmdline(true) end)
|
||||||
|
describe('ui/ext_cmdline (legacy highlights)', function() test_cmdline(false) end)
|
||||||
|
@ -188,15 +188,15 @@ describe('ui/cursor', function()
|
|||||||
-- Event is published ONLY if the cursor style changed.
|
-- Event is published ONLY if the cursor style changed.
|
||||||
screen._mode_info = nil
|
screen._mode_info = nil
|
||||||
command("echo 'test'")
|
command("echo 'test'")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
test |
|
test |
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq(nil, screen._mode_info)
|
eq(nil, screen._mode_info)
|
||||||
end)
|
end}
|
||||||
|
|
||||||
-- Change the cursor style.
|
-- Change the cursor style.
|
||||||
helpers.command('hi Cursor guibg=DarkGray')
|
helpers.command('hi Cursor guibg=DarkGray')
|
||||||
|
@ -745,19 +745,19 @@ describe(":substitute, inccommand=split", function()
|
|||||||
it("shows preview when cmd modifiers are present", function()
|
it("shows preview when cmd modifiers are present", function()
|
||||||
-- one modifier
|
-- one modifier
|
||||||
feed(':keeppatterns %s/tw/to')
|
feed(':keeppatterns %s/tw/to')
|
||||||
screen:expect([[{12:to}o lines]], nil, nil, nil, true)
|
screen:expect{any=[[{12:to}o lines]]}
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
screen:expect([[two lines]], nil, nil, nil, true)
|
screen:expect{any=[[two lines]]}
|
||||||
|
|
||||||
-- multiple modifiers
|
-- multiple modifiers
|
||||||
feed(':keeppatterns silent %s/tw/to')
|
feed(':keeppatterns silent %s/tw/to')
|
||||||
screen:expect([[{12:to}o lines]], nil, nil, nil, true)
|
screen:expect{any=[[{12:to}o lines]]}
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
screen:expect([[two lines]], nil, nil, nil, true)
|
screen:expect{any=[[two lines]]}
|
||||||
|
|
||||||
-- non-modifier prefix
|
-- non-modifier prefix
|
||||||
feed(':silent tabedit %s/tw/to')
|
feed(':silent tabedit %s/tw/to')
|
||||||
screen:expect([[two lines]], nil, nil, nil, true)
|
screen:expect{any=[[two lines]]}
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -1222,19 +1222,19 @@ describe("inccommand=nosplit", function()
|
|||||||
it("shows preview when cmd modifiers are present", function()
|
it("shows preview when cmd modifiers are present", function()
|
||||||
-- one modifier
|
-- one modifier
|
||||||
feed(':keeppatterns %s/tw/to')
|
feed(':keeppatterns %s/tw/to')
|
||||||
screen:expect([[{12:to}o lines]], nil, nil, nil, true)
|
screen:expect{any=[[{12:to}o lines]]}
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
screen:expect([[two lines]], nil, nil, nil, true)
|
screen:expect{any=[[two lines]]}
|
||||||
|
|
||||||
-- multiple modifiers
|
-- multiple modifiers
|
||||||
feed(':keeppatterns silent %s/tw/to')
|
feed(':keeppatterns silent %s/tw/to')
|
||||||
screen:expect([[{12:to}o lines]], nil, nil, nil, true)
|
screen:expect{any=[[{12:to}o lines]]}
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
screen:expect([[two lines]], nil, nil, nil, true)
|
screen:expect{any=[[two lines]]}
|
||||||
|
|
||||||
-- non-modifier prefix
|
-- non-modifier prefix
|
||||||
feed(':silent tabedit %s/tw/to')
|
feed(':silent tabedit %s/tw/to')
|
||||||
screen:expect([[two lines]], nil, nil, nil, true)
|
screen:expect{any=[[two lines]]}
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -21,207 +21,169 @@ describe('ui mode_change event', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works in normal mode', function()
|
it('works in normal mode', function()
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]],nil,nil,function ()
|
]], mode="normal"}
|
||||||
eq("normal", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('d')
|
feed('d')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]],nil,nil,function ()
|
]], mode="operator"}
|
||||||
eq("operator", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<esc>')
|
feed('<esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]],nil,nil,function ()
|
]], mode="normal"}
|
||||||
eq("normal", screen.mode)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works in insert mode', function()
|
it('works in insert mode', function()
|
||||||
feed('i')
|
feed('i')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{2:-- INSERT --} |
|
{2:-- INSERT --} |
|
||||||
]],nil,nil,function ()
|
]], mode="insert"}
|
||||||
eq("insert", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('word<esc>')
|
feed('word<esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
wor^d |
|
wor^d |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function ()
|
]], mode="normal"}
|
||||||
eq("normal", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
command("set showmatch")
|
command("set showmatch")
|
||||||
eq(eval('&matchtime'), 5) -- tenths of seconds
|
eq(eval('&matchtime'), 5) -- tenths of seconds
|
||||||
feed('a(stuff')
|
feed('a(stuff')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
word(stuff^ |
|
word(stuff^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{2:-- INSERT --} |
|
{2:-- INSERT --} |
|
||||||
]], nil, nil, function ()
|
]], mode="insert"}
|
||||||
eq("insert", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed(')')
|
feed(')')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
word^(stuff) |
|
word^(stuff) |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{2:-- INSERT --} |
|
{2:-- INSERT --} |
|
||||||
]], nil, nil, function ()
|
]], mode="showmatch"}
|
||||||
eq("showmatch", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
screen:sleep(400)
|
screen:sleep(400)
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
word(stuff)^ |
|
word(stuff)^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{2:-- INSERT --} |
|
{2:-- INSERT --} |
|
||||||
]], nil, nil, function ()
|
]], mode="insert"}
|
||||||
eq("insert", screen.mode)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works in replace mode', function()
|
it('works in replace mode', function()
|
||||||
feed('R')
|
feed('R')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{2:-- REPLACE --} |
|
{2:-- REPLACE --} |
|
||||||
]], nil, nil, function ()
|
]], mode="replace"}
|
||||||
eq("replace", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('word<esc>')
|
feed('word<esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
wor^d |
|
wor^d |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]], nil, nil, function ()
|
]], mode="normal"}
|
||||||
eq("normal", screen.mode)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works in cmdline mode', function()
|
it('works in cmdline mode', function()
|
||||||
feed(':')
|
feed(':')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
:^ |
|
:^ |
|
||||||
]],nil,nil,function ()
|
]], mode="cmdline_normal"}
|
||||||
eq("cmdline_normal", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('x<left>')
|
feed('x<left>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
:^x |
|
:^x |
|
||||||
]],nil,nil,function ()
|
]], mode="cmdline_insert"}
|
||||||
eq("cmdline_insert", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<insert>')
|
feed('<insert>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
:^x |
|
:^x |
|
||||||
]],nil,nil,function ()
|
]], mode="cmdline_replace"}
|
||||||
eq("cmdline_replace", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
feed('<right>')
|
feed('<right>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
:x^ |
|
:x^ |
|
||||||
]],nil,nil,function ()
|
]], mode="cmdline_normal"}
|
||||||
eq("cmdline_normal", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<esc>')
|
feed('<esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]],nil,nil,function ()
|
]], mode="normal"}
|
||||||
eq("normal", screen.mode)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works in visal mode', function()
|
it('works in visual mode', function()
|
||||||
insert("text")
|
insert("text")
|
||||||
feed('v')
|
feed('v')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
tex^t |
|
tex^t |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{2:-- VISUAL --} |
|
{2:-- VISUAL --} |
|
||||||
]],nil,nil,function ()
|
]], mode="visual"}
|
||||||
eq("visual", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<esc>')
|
feed('<esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
tex^t |
|
tex^t |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]],nil,nil,function ()
|
]], mode="normal"}
|
||||||
eq("normal", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
command('set selection=exclusive')
|
command('set selection=exclusive')
|
||||||
feed('v')
|
feed('v')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
tex^t |
|
tex^t |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{2:-- VISUAL --} |
|
{2:-- VISUAL --} |
|
||||||
]],nil,nil,function ()
|
]], mode="visual_select"}
|
||||||
eq("visual_select", screen.mode)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<esc>')
|
feed('<esc>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
tex^t |
|
tex^t |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]],nil,nil,function ()
|
]], mode="normal"}
|
||||||
eq("normal", screen.mode)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ describe("shell command :!", function()
|
|||||||
":!for i in $(seq 2 3000); do echo XXXXXXXXXX $i; done\n")
|
":!for i in $(seq 2 3000); do echo XXXXXXXXXX $i; done\n")
|
||||||
|
|
||||||
-- If we observe any line starting with a dot, then throttling occurred.
|
-- If we observe any line starting with a dot, then throttling occurred.
|
||||||
screen:expect("\n.", nil, nil, nil, true)
|
screen:expect{any="\n."}
|
||||||
|
|
||||||
-- Final chunk of output should always be displayed, never skipped.
|
-- Final chunk of output should always be displayed, never skipped.
|
||||||
-- (Throttling is non-deterministic, this test is merely a sanity check.)
|
-- (Throttling is non-deterministic, this test is merely a sanity check.)
|
||||||
@ -92,7 +92,7 @@ describe("shell command :!", function()
|
|||||||
eq(2, eval('1+1')) -- Still alive?
|
eq(2, eval('1+1')) -- Still alive?
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it([[handles control codes]], function()
|
it('handles control codes', function()
|
||||||
if iswin() then
|
if iswin() then
|
||||||
pending('missing printf', function() end)
|
pending('missing printf', function() end)
|
||||||
return
|
return
|
||||||
@ -112,14 +112,14 @@ describe("shell command :!", function()
|
|||||||
-- Print BELL control code. #4338
|
-- Print BELL control code. #4338
|
||||||
screen.bell = false
|
screen.bell = false
|
||||||
feed([[:!printf '\007\007\007\007text'<CR>]])
|
feed([[:!printf '\007\007\007\007text'<CR>]])
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
~ |
|
~ |
|
||||||
:!printf '\007\007\007\007text' |
|
:!printf '\007\007\007\007text' |
|
||||||
text |
|
text |
|
||||||
Press ENTER or type command to continue^ |
|
Press ENTER or type command to continue^ |
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq(true, screen.bell)
|
eq(true, screen.bell)
|
||||||
end)
|
end}
|
||||||
feed([[<CR>]])
|
feed([[<CR>]])
|
||||||
-- Print BS control code.
|
-- Print BS control code.
|
||||||
feed([[:echo system('printf ''\010\n''')<CR>]])
|
feed([[:echo system('printf ''\010\n''')<CR>]])
|
||||||
@ -188,7 +188,7 @@ describe("shell command :!", function()
|
|||||||
it('handles binary and multibyte data', function()
|
it('handles binary and multibyte data', function()
|
||||||
feed_command('!cat test/functional/fixtures/shell_data.txt')
|
feed_command('!cat test/functional/fixtures/shell_data.txt')
|
||||||
screen.bell = false
|
screen.bell = false
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{4: }|
|
{4: }|
|
||||||
@ -199,9 +199,9 @@ describe("shell command :!", function()
|
|||||||
t {2:<ff>} |
|
t {2:<ff>} |
|
||||||
|
|
|
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq(true, screen.bell)
|
eq(true, screen.bell)
|
||||||
end)
|
end}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles multibyte sequences split over buffer boundaries', function()
|
it('handles multibyte sequences split over buffer boundaries', function()
|
||||||
|
91
test/functional/ui/popupmenu_spec.lua
Normal file
91
test/functional/ui/popupmenu_spec.lua
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
|
local source = helpers.source
|
||||||
|
|
||||||
|
describe('ui/ext_popupmenu', function()
|
||||||
|
local screen
|
||||||
|
before_each(function()
|
||||||
|
clear()
|
||||||
|
screen = Screen.new(60, 8)
|
||||||
|
screen:attach({rgb=true, ext_popupmenu=true})
|
||||||
|
screen:set_default_attr_ids({
|
||||||
|
[1] = {bold=true, foreground=Screen.colors.Blue},
|
||||||
|
[2] = {bold = true},
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('works', function()
|
||||||
|
source([[
|
||||||
|
function! TestComplete() abort
|
||||||
|
call complete(1, ['foo', 'bar', 'spam'])
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
]])
|
||||||
|
local expected = {
|
||||||
|
{'foo', '', '', ''},
|
||||||
|
{'bar', '', '', ''},
|
||||||
|
{'spam', '', '', ''},
|
||||||
|
}
|
||||||
|
feed('o<C-r>=TestComplete()<CR>')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
|
|
||||||
|
foo^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2:-- INSERT --} |
|
||||||
|
]], popupmenu={
|
||||||
|
items=expected,
|
||||||
|
pos=0,
|
||||||
|
anchor={1,0},
|
||||||
|
}}
|
||||||
|
|
||||||
|
feed('<c-p>')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
|
|
||||||
|
^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2:-- INSERT --} |
|
||||||
|
]], popupmenu={
|
||||||
|
items=expected,
|
||||||
|
pos=-1,
|
||||||
|
anchor={1,0},
|
||||||
|
}}
|
||||||
|
|
||||||
|
-- down moves the selection in the menu, but does not insert anything
|
||||||
|
feed('<down><down>')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
|
|
||||||
|
^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2:-- INSERT --} |
|
||||||
|
]], popupmenu={
|
||||||
|
items=expected,
|
||||||
|
pos=1,
|
||||||
|
anchor={1,0},
|
||||||
|
}}
|
||||||
|
|
||||||
|
feed('<cr>')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
|
|
||||||
|
bar^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2:-- INSERT --} |
|
||||||
|
]]}
|
||||||
|
end)
|
||||||
|
end)
|
@ -71,6 +71,8 @@
|
|||||||
-- To help write screen tests, see Screen:snapshot_util().
|
-- To help write screen tests, see Screen:snapshot_util().
|
||||||
-- To debug screen tests, see Screen:redraw_debug().
|
-- To debug screen tests, see Screen:redraw_debug().
|
||||||
|
|
||||||
|
local global_helpers = require('test.helpers')
|
||||||
|
local shallowcopy = global_helpers.shallowcopy
|
||||||
local helpers = require('test.functional.helpers')(nil)
|
local helpers = require('test.functional.helpers')(nil)
|
||||||
local request, run, uimeths = helpers.request, helpers.run, helpers.uimeths
|
local request, run, uimeths = helpers.request, helpers.run, helpers.uimeths
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
@ -139,6 +141,11 @@ function Screen.new(width, height)
|
|||||||
suspended = false,
|
suspended = false,
|
||||||
mode = 'normal',
|
mode = 'normal',
|
||||||
options = {},
|
options = {},
|
||||||
|
popupmenu = nil,
|
||||||
|
cmdline = {},
|
||||||
|
cmdline_block = {},
|
||||||
|
wildmenu_items = nil,
|
||||||
|
wildmenu_selected = nil,
|
||||||
_default_attr_ids = nil,
|
_default_attr_ids = nil,
|
||||||
_default_attr_ignore = nil,
|
_default_attr_ignore = nil,
|
||||||
_mouse_enabled = true,
|
_mouse_enabled = true,
|
||||||
@ -193,32 +200,80 @@ function Screen:set_option(option, value)
|
|||||||
self._options[option] = value
|
self._options[option] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Asserts that `expected` eventually matches the screen state.
|
-- Asserts that the screen state eventually matches an expected state
|
||||||
--
|
--
|
||||||
-- expected: Expected screen state (string). Each line represents a screen
|
-- This function can either be called with the positional forms
|
||||||
|
--
|
||||||
|
-- screen:expect(grid, [attr_ids, attr_ignore])
|
||||||
|
-- screen:expect(condition)
|
||||||
|
--
|
||||||
|
-- or to use additional arguments (or grid and condition at the same time)
|
||||||
|
-- the keyword form has to be used:
|
||||||
|
--
|
||||||
|
-- screen:expect{grid=[[...]], cmdline={...}, condition=function() ... end}
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- grid: Expected screen state (string). Each line represents a screen
|
||||||
-- row. Last character of each row (typically "|") is stripped.
|
-- row. Last character of each row (typically "|") is stripped.
|
||||||
-- Common indentation is stripped.
|
-- Common indentation is stripped.
|
||||||
-- Used as `condition` if NOT a string; must be the ONLY arg then.
|
|
||||||
-- attr_ids: Expected text attributes. Screen rows are transformed according
|
-- attr_ids: Expected text attributes. Screen rows are transformed according
|
||||||
-- to this table, as follows: each substring S composed of
|
-- to this table, as follows: each substring S composed of
|
||||||
-- characters having the same attributes will be substituted by
|
-- characters having the same attributes will be substituted by
|
||||||
-- "{K:S}", where K is a key in `attr_ids`. Any unexpected
|
-- "{K:S}", where K is a key in `attr_ids`. Any unexpected
|
||||||
-- attributes in the final state are an error.
|
-- attributes in the final state are an error.
|
||||||
-- attr_ignore: Ignored text attributes, or `true` to ignore all.
|
-- Use screen:set_default_attr_ids() to define attributes for many
|
||||||
-- condition: Function asserting some arbitrary condition.
|
-- expect() calls.
|
||||||
-- any: true: Succeed if `expected` matches ANY screen line(s).
|
-- attr_ignore: Ignored text attributes, or `true` to ignore all. By default
|
||||||
-- false (default): `expected` must match screen exactly.
|
-- nothing is ignored.
|
||||||
function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
|
-- condition: Function asserting some arbitrary condition. Return value is
|
||||||
|
-- ignored, throw an error (use eq() or similar) to signal failure.
|
||||||
|
-- any: A string that should be present on any line of the screen.
|
||||||
|
-- mode: Expected mode as signaled by "mode_change" event
|
||||||
|
--
|
||||||
|
-- The following keys should be used to expect the state of various ext_
|
||||||
|
-- features. Note that an absent key will assert that the item is currently
|
||||||
|
-- NOT present on the screen, also when positional form is used.
|
||||||
|
--
|
||||||
|
-- popupmenu: Expected ext_popupmenu state,
|
||||||
|
-- cmdline: Expected ext_cmdline state, as an array of cmdlines of
|
||||||
|
-- different level.
|
||||||
|
-- cmdline_block: Expected ext_cmdline block (for function definitions)
|
||||||
|
-- wildmenu_items: Expected items for ext_wildmenu
|
||||||
|
-- wildmenu_pos: Expected position for ext_wildmenu
|
||||||
|
function Screen:expect(expected, attr_ids, attr_ignore)
|
||||||
|
local grid, condition = nil, nil
|
||||||
local expected_rows = {}
|
local expected_rows = {}
|
||||||
if type(expected) ~= "string" then
|
if type(expected) == "table" then
|
||||||
assert(not (attr_ids or attr_ignore or condition or any))
|
assert(not (attr_ids ~= nil or attr_ignore ~= nil))
|
||||||
|
local is_key = {grid=true, attr_ids=true, attr_ignore=true, condition=true,
|
||||||
|
any=true, mode=true, popupmenu=true, cmdline=true,
|
||||||
|
cmdline_block=true, wildmenu_items=true, wildmenu_pos=true}
|
||||||
|
for k, _ in pairs(expected) do
|
||||||
|
if not is_key[k] then
|
||||||
|
error("Screen:expect: Unknown keyword argument '"..k.."'")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
grid = expected.grid
|
||||||
|
attr_ids = expected.attr_ids
|
||||||
|
attr_ignore = expected.attr_ignore
|
||||||
|
condition = expected.condition
|
||||||
|
assert(not (expected.any ~= nil and grid ~= nil))
|
||||||
|
elseif type(expected) == "string" then
|
||||||
|
grid = expected
|
||||||
|
expected = {}
|
||||||
|
elseif type(expected) == "function" then
|
||||||
|
assert(not (attr_ids ~= nil or attr_ignore ~= nil))
|
||||||
condition = expected
|
condition = expected
|
||||||
expected = nil
|
expected = {}
|
||||||
else
|
else
|
||||||
|
assert(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
if grid ~= nil then
|
||||||
-- Remove the last line and dedent. Note that gsub returns more then one
|
-- Remove the last line and dedent. Note that gsub returns more then one
|
||||||
-- value.
|
-- value.
|
||||||
expected = dedent(expected:gsub('\n[ ]+$', ''), 0)
|
grid = dedent(grid:gsub('\n[ ]+$', ''), 0)
|
||||||
for row in expected:gmatch('[^\n]+') do
|
for row in grid:gmatch('[^\n]+') do
|
||||||
row = row:sub(1, #row - 1) -- Last char must be the screen delimiter.
|
row = row:sub(1, #row - 1) -- Last char must be the screen delimiter.
|
||||||
table.insert(expected_rows, row)
|
table.insert(expected_rows, row)
|
||||||
end
|
end
|
||||||
@ -238,7 +293,7 @@ function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if expected and not any and self._height ~= #expected_rows then
|
if grid ~= nil and self._height ~= #expected_rows then
|
||||||
return ("Expected screen state's row count(" .. #expected_rows
|
return ("Expected screen state's row count(" .. #expected_rows
|
||||||
.. ') differs from configured height(' .. self._height .. ') of Screen.')
|
.. ') differs from configured height(' .. self._height .. ') of Screen.')
|
||||||
end
|
end
|
||||||
@ -253,18 +308,18 @@ function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
|
|||||||
actual_rows[i] = self:_row_repr(self._rows[i], info, ignore)
|
actual_rows[i] = self:_row_repr(self._rows[i], info, ignore)
|
||||||
end
|
end
|
||||||
|
|
||||||
if expected == nil then
|
if expected.any ~= nil then
|
||||||
return
|
-- Search for `any` anywhere in the screen lines.
|
||||||
elseif any then
|
|
||||||
-- Search for `expected` anywhere in the screen lines.
|
|
||||||
local actual_screen_str = table.concat(actual_rows, '\n')
|
local actual_screen_str = table.concat(actual_rows, '\n')
|
||||||
if nil == string.find(actual_screen_str, expected) then
|
if nil == string.find(actual_screen_str, expected.any) then
|
||||||
return (
|
return (
|
||||||
'Failed to match any screen lines.\n'
|
'Failed to match any screen lines.\n'
|
||||||
.. 'Expected (anywhere): "' .. expected .. '"\n'
|
.. 'Expected (anywhere): "' .. expected.any .. '"\n'
|
||||||
.. 'Actual:\n |' .. table.concat(actual_rows, '|\n |') .. '|\n\n')
|
.. 'Actual:\n |' .. table.concat(actual_rows, '|\n |') .. '|\n\n')
|
||||||
end
|
end
|
||||||
else
|
end
|
||||||
|
|
||||||
|
if grid ~= nil then
|
||||||
-- `expected` must match the screen lines exactly.
|
-- `expected` must match the screen lines exactly.
|
||||||
for i = 1, self._height do
|
for i = 1, self._height do
|
||||||
if expected_rows[i] ~= actual_rows[i] then
|
if expected_rows[i] ~= actual_rows[i] then
|
||||||
@ -284,6 +339,38 @@ screen:redraw_debug() to show all intermediate screen states. ]])
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Extension features. The default expectations should cover the case of
|
||||||
|
-- the ext_ feature being disabled, or the feature currently not activated
|
||||||
|
-- (for instance no external cmdline visible)
|
||||||
|
local expected_cmdline = expected.cmdline or {}
|
||||||
|
local actual_cmdline = {}
|
||||||
|
for i, entry in pairs(self.cmdline) do
|
||||||
|
entry = shallowcopy(entry)
|
||||||
|
entry.content = self:_chunks_repr(entry.content, info, ignore)
|
||||||
|
actual_cmdline[i] = entry
|
||||||
|
end
|
||||||
|
|
||||||
|
local expected_block = expected.cmdline_block or {}
|
||||||
|
local actual_block = {}
|
||||||
|
for i, entry in ipairs(self.cmdline_block) do
|
||||||
|
actual_block[i] = self:_chunks_repr(entry, info, ignore)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- convert assertion errors into invalid screen state descriptions
|
||||||
|
local status, res = pcall(function()
|
||||||
|
eq(expected.popupmenu, self.popupmenu, "popupmenu")
|
||||||
|
eq(expected_cmdline, actual_cmdline, "cmdline")
|
||||||
|
eq(expected_block, actual_block, "cmdline_block")
|
||||||
|
eq(expected.wildmenu_items, self.wildmenu_items, "wildmenu_items")
|
||||||
|
eq(expected.wildmenu_pos, self.wildmenu_pos, "wildmenu_pos")
|
||||||
|
if expected.mode ~= nil then
|
||||||
|
eq(expected.mode, self.mode, "mode")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
if not status then
|
||||||
|
return tostring(res)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -510,14 +597,6 @@ function Screen:_handle_hl_attr_define(id, rgb_attrs, cterm_attrs, info)
|
|||||||
self._new_attrs = true
|
self._new_attrs = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function Screen:get_hl(val)
|
|
||||||
if self._options.ext_newgrid then
|
|
||||||
return self._attr_table[val][1]
|
|
||||||
else
|
|
||||||
return val
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Screen:_handle_highlight_set(attrs)
|
function Screen:_handle_highlight_set(attrs)
|
||||||
self._attrs = attrs
|
self._attrs = attrs
|
||||||
end
|
end
|
||||||
@ -595,6 +674,63 @@ function Screen:_handle_option_set(name, value)
|
|||||||
self.options[name] = value
|
self.options[name] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_popupmenu_show(items, selected, row, col)
|
||||||
|
self.popupmenu = {items=items,pos=selected, anchor={row, col}}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_popupmenu_select(selected)
|
||||||
|
self.popupmenu.pos = selected
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_popupmenu_hide()
|
||||||
|
self.popupmenu = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_cmdline_show(content, pos, firstc, prompt, indent, level)
|
||||||
|
if firstc == '' then firstc = nil end
|
||||||
|
if prompt == '' then prompt = nil end
|
||||||
|
if indent == 0 then indent = nil end
|
||||||
|
self.cmdline[level] = {content=content, pos=pos, firstc=firstc,
|
||||||
|
prompt=prompt, indent=indent}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_cmdline_hide(level)
|
||||||
|
self.cmdline[level] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_cmdline_special_char(char, shift, level)
|
||||||
|
-- cleared by next cmdline_show on the same level
|
||||||
|
self.cmdline[level].special = {char, shift}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_cmdline_pos(pos, level)
|
||||||
|
self.cmdline[level].pos = pos
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_cmdline_block_show(block)
|
||||||
|
self.cmdline_block = block
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_cmdline_block_append(item)
|
||||||
|
self.cmdline_block[#self.cmdline_block+1] = item
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_cmdline_block_hide()
|
||||||
|
self.cmdline_block = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_wildmenu_show(items)
|
||||||
|
self.wildmenu_items = items
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_wildmenu_select(pos)
|
||||||
|
self.wildmenu_pos = pos
|
||||||
|
end
|
||||||
|
|
||||||
|
function Screen:_handle_wildmenu_hide()
|
||||||
|
self.wildmenu_items, self.wildmenu_pos = nil, nil
|
||||||
|
end
|
||||||
|
|
||||||
function Screen:_clear_block(top, bot, left, right)
|
function Screen:_clear_block(top, bot, left, right)
|
||||||
for i = top, bot do
|
for i = top, bot do
|
||||||
self:_clear_row_section(i, left, right)
|
self:_clear_row_section(i, left, right)
|
||||||
@ -643,6 +779,21 @@ function Screen:_row_repr(row, attr_ids, attr_ignore)
|
|||||||
return table.concat(rv, '')--:gsub('%s+$', '')
|
return table.concat(rv, '')--:gsub('%s+$', '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Screen:_chunks_repr(chunks, attr_ids, attr_ignore)
|
||||||
|
local repr_chunks = {}
|
||||||
|
for i, chunk in ipairs(chunks) do
|
||||||
|
local hl, text = unpack(chunk)
|
||||||
|
local attrs
|
||||||
|
if self._options.ext_newgrid then
|
||||||
|
attrs = self._attr_table[hl][1]
|
||||||
|
else
|
||||||
|
attrs = hl
|
||||||
|
end
|
||||||
|
local attr_id = self:_get_attr_id(attr_ids, attr_ignore, attrs, hl)
|
||||||
|
repr_chunks[i] = {text, attr_id}
|
||||||
|
end
|
||||||
|
return repr_chunks
|
||||||
|
end
|
||||||
|
|
||||||
function Screen:_current_screen()
|
function Screen:_current_screen()
|
||||||
-- get a string that represents the current screen state(debugging helper)
|
-- get a string that represents the current screen state(debugging helper)
|
||||||
|
@ -28,27 +28,27 @@ describe('ui/ext_tabline', function()
|
|||||||
{tab = { id = 1 }, name = '[No Name]'},
|
{tab = { id = 1 }, name = '[No Name]'},
|
||||||
{tab = { id = 2 }, name = 'another-tab'},
|
{tab = { id = 2 }, name = 'another-tab'},
|
||||||
}
|
}
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq({ id = 2 }, event_curtab)
|
eq({ id = 2 }, event_curtab)
|
||||||
eq(expected_tabs, event_tabs)
|
eq(expected_tabs, event_tabs)
|
||||||
end)
|
end}
|
||||||
|
|
||||||
command("tabNext")
|
command("tabNext")
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq({ id = 1 }, event_curtab)
|
eq({ id = 1 }, event_curtab)
|
||||||
eq(expected_tabs, event_tabs)
|
eq(expected_tabs, event_tabs)
|
||||||
end)
|
end}
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -167,7 +167,7 @@ describe("'wildmenu'", function()
|
|||||||
screen:sleep(10) -- Flush
|
screen:sleep(10) -- Flush
|
||||||
-- 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('! # & < = > @ > \n:!^', nil, nil, nil, true)
|
screen:expect{any='! # & < = > @ > \n:!^'}
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -204,21 +204,11 @@ end)
|
|||||||
|
|
||||||
describe('ui/ext_wildmenu', function()
|
describe('ui/ext_wildmenu', function()
|
||||||
local screen
|
local screen
|
||||||
local items, selected = nil, nil
|
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = Screen.new(25, 5)
|
screen = Screen.new(25, 5)
|
||||||
screen:attach({rgb=true, ext_wildmenu=true})
|
screen:attach({rgb=true, ext_wildmenu=true})
|
||||||
screen:set_on_event_handler(function(name, data)
|
|
||||||
if name == "wildmenu_show" then
|
|
||||||
items = data[1]
|
|
||||||
elseif name == "wildmenu_select" then
|
|
||||||
selected = data[1]
|
|
||||||
elseif name == "wildmenu_hide" then
|
|
||||||
items, selected = nil, nil
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
@ -238,63 +228,48 @@ describe('ui/ext_wildmenu', function()
|
|||||||
command('set wildmode=full')
|
command('set wildmode=full')
|
||||||
command('set wildmenu')
|
command('set wildmenu')
|
||||||
feed(':sign <tab>')
|
feed(':sign <tab>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
:sign define^ |
|
:sign define^ |
|
||||||
]], nil, nil, function()
|
]], wildmenu_items=expected, wildmenu_pos=0}
|
||||||
eq(expected, items)
|
|
||||||
eq(0, selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<tab>')
|
feed('<tab>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
:sign jump^ |
|
:sign jump^ |
|
||||||
]], nil, nil, function()
|
]], wildmenu_items=expected, wildmenu_pos=1}
|
||||||
eq(expected, items)
|
|
||||||
eq(1, selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<left><left>')
|
feed('<left><left>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
:sign ^ |
|
:sign ^ |
|
||||||
]], nil, nil, function()
|
]], wildmenu_items=expected, wildmenu_pos=-1}
|
||||||
eq(expected, items)
|
|
||||||
eq(-1, selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<right>')
|
feed('<right>')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
:sign define^ |
|
:sign define^ |
|
||||||
]], nil, nil, function()
|
]], wildmenu_items=expected, wildmenu_pos=0}
|
||||||
eq(expected, items)
|
|
||||||
eq(0, selected)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('a')
|
feed('a')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
|
|
|
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
:sign definea^ |
|
:sign definea^ |
|
||||||
]], nil, nil, function()
|
]]}
|
||||||
eq(nil, items)
|
|
||||||
eq(nil, selected)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -873,107 +873,6 @@ describe('completion', function()
|
|||||||
{3:-- Keyword Local completion (^N^P) }{4:match 1 of 7} |
|
{3:-- Keyword Local completion (^N^P) }{4:match 1 of 7} |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
end)
|
|
||||||
|
|
||||||
describe('ui/ext_popupmenu', function()
|
|
||||||
local screen
|
|
||||||
local items, selected, anchor
|
|
||||||
before_each(function()
|
|
||||||
clear()
|
|
||||||
screen = Screen.new(60, 8)
|
|
||||||
screen:attach({rgb=true, ext_popupmenu=true})
|
|
||||||
screen:set_default_attr_ids({
|
|
||||||
[1] = {bold=true, foreground=Screen.colors.Blue},
|
|
||||||
[2] = {bold = true},
|
|
||||||
})
|
|
||||||
screen:set_on_event_handler(function(name, data)
|
|
||||||
if name == "popupmenu_show" then
|
|
||||||
local row, col
|
|
||||||
items, selected, row, col = unpack(data)
|
|
||||||
anchor = {row, col}
|
|
||||||
elseif name == "popupmenu_select" then
|
|
||||||
selected = data[1]
|
|
||||||
elseif name == "popupmenu_hide" then
|
|
||||||
items = nil
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('works', function()
|
|
||||||
source([[
|
|
||||||
function! TestComplete() abort
|
|
||||||
call complete(1, ['foo', 'bar', 'spam'])
|
|
||||||
return ''
|
|
||||||
endfunction
|
|
||||||
]])
|
|
||||||
local expected = {
|
|
||||||
{'foo', '', '', ''},
|
|
||||||
{'bar', '', '', ''},
|
|
||||||
{'spam', '', '', ''},
|
|
||||||
}
|
|
||||||
feed('o<C-r>=TestComplete()<CR>')
|
|
||||||
screen:expect([[
|
|
||||||
|
|
|
||||||
foo^ |
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{2:-- INSERT --} |
|
|
||||||
]], nil, nil, function()
|
|
||||||
eq(expected, items)
|
|
||||||
eq(0, selected)
|
|
||||||
eq({1,0}, anchor)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<c-p>')
|
|
||||||
screen:expect([[
|
|
||||||
|
|
|
||||||
^ |
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{2:-- INSERT --} |
|
|
||||||
]], nil, nil, function()
|
|
||||||
eq(expected, items)
|
|
||||||
eq(-1, selected)
|
|
||||||
eq({1,0}, anchor)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- down moves the selection in the menu, but does not insert anything
|
|
||||||
feed('<down><down>')
|
|
||||||
screen:expect([[
|
|
||||||
|
|
|
||||||
^ |
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{2:-- INSERT --} |
|
|
||||||
]], nil, nil, function()
|
|
||||||
eq(expected, items)
|
|
||||||
eq(1, selected)
|
|
||||||
eq({1,0}, anchor)
|
|
||||||
end)
|
|
||||||
|
|
||||||
feed('<cr>')
|
|
||||||
screen:expect([[
|
|
||||||
|
|
|
||||||
bar^ |
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{2:-- INSERT --} |
|
|
||||||
]], nil, nil, function()
|
|
||||||
eq(nil, items) -- popupmenu was hidden
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('TextChangedP autocommand', function()
|
it('TextChangedP autocommand', function()
|
||||||
curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar'})
|
curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar'})
|
||||||
|
@ -45,8 +45,8 @@ local check_logs_useless_lines = {
|
|||||||
['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
|
['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function eq(expected, actual)
|
local function eq(expected, actual, ctx)
|
||||||
return assert.are.same(expected, actual)
|
return assert.are.same(expected, actual, ctx)
|
||||||
end
|
end
|
||||||
local function neq(expected, actual)
|
local function neq(expected, actual)
|
||||||
return assert.are_not.same(expected, actual)
|
return assert.are_not.same(expected, actual)
|
||||||
|
Loading…
Reference in New Issue
Block a user