diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/mouse_spec.lua | 10 | ||||
-rw-r--r-- | test/functional/ui/statuscolumn_spec.lua | 82 | ||||
-rw-r--r-- | test/functional/ui/statusline_spec.lua | 348 | ||||
-rw-r--r-- | test/old/testdir/test_charsearch.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_expr.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_functions.vim | 13 | ||||
-rw-r--r-- | test/old/testdir/test_listdict.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_maparg.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_matchfuzzy.vim | 8 | ||||
-rw-r--r-- | test/old/testdir/test_partial.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_search_stat.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_signs.vim | 12 | ||||
-rw-r--r-- | test/old/testdir/test_tagjump.vim | 8 | ||||
-rw-r--r-- | test/old/testdir/test_timers.vim | 8 | ||||
-rw-r--r-- | test/old/testdir/test_window_cmd.vim | 6 | ||||
-rw-r--r-- | test/unit/helpers.lua | 1 |
16 files changed, 260 insertions, 248 deletions
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index f705678bd5..c7f6861c12 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1840,16 +1840,6 @@ describe('ui/mouse/input', function() eq({2, 9}, meths.win_get_cursor(0)) eq('', funcs.getreg('"')) - -- Try clicking on the status line - funcs.setreg('"', '') - meths.win_set_cursor(0, {1, 9}) - feed('vee') - meths.input_mouse('right', 'press', '', 0, 5, 1) - meths.input_mouse('right', 'release', '', 0, 5, 1) - feed('<Down><CR>') - eq({1, 9}, meths.win_get_cursor(0)) - eq('ran away', funcs.getreg('"')) - -- Try clicking outside the window funcs.setreg('"', '') meths.win_set_cursor(0, {2, 1}) diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index c4b055d289..3b41d3684a 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -9,6 +9,8 @@ local feed = helpers.feed local meths = helpers.meths local pcall_err = helpers.pcall_err +local mousemodels = { "extend", "popup", "popup_setpos" } + describe('statuscolumn', function() local screen before_each(function() @@ -420,45 +422,47 @@ describe('statuscolumn', function() ]]) end) - it("works with 'statuscolumn' clicks", function() - command('set mousemodel=extend') - command([[ - function! MyClickFunc(minwid, clicks, button, mods) - let g:testvar = printf("%d %d %s %d", a:minwid, a:clicks, a:button, getmousepos().line) - if a:mods !=# ' ' - let g:testvar ..= '(' .. a:mods .. ')' - endif - endfunction - set stc=%0@MyClickFunc@%=%l%T - ]]) - meths.input_mouse('left', 'press', '', 0, 0, 0) - eq('0 1 l 4', eval("g:testvar")) - meths.input_mouse('left', 'press', '', 0, 0, 0) - eq('0 2 l 4', eval("g:testvar")) - meths.input_mouse('left', 'press', '', 0, 0, 0) - eq('0 3 l 4', eval("g:testvar")) - meths.input_mouse('left', 'press', '', 0, 0, 0) - eq('0 4 l 4', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 3, 0) - eq('0 1 r 7', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 3, 0) - eq('0 2 r 7', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 3, 0) - eq('0 3 r 7', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 3, 0) - eq('0 4 r 7', eval("g:testvar")) - command('set laststatus=2 winbar=%f') - command('let g:testvar=""') - -- Check that winbar click doesn't register as statuscolumn click - meths.input_mouse('right', 'press', '', 0, 0, 0) - eq('', eval("g:testvar")) - -- Check that statusline click doesn't register as statuscolumn click - meths.input_mouse('right', 'press', '', 0, 12, 0) - eq('', eval("g:testvar")) - -- Check that cmdline click doesn't register as statuscolumn click - meths.input_mouse('right', 'press', '', 0, 13, 0) - eq('', eval("g:testvar")) - end) + for _, model in ipairs(mousemodels) do + it("works with 'statuscolumn' clicks with mousemodel=" .. model, function() + command('set mousemodel=' .. model) + command([[ + function! MyClickFunc(minwid, clicks, button, mods) + let g:testvar = printf("%d %d %s %d", a:minwid, a:clicks, a:button, getmousepos().line) + if a:mods !=# ' ' + let g:testvar ..= '(' .. a:mods .. ')' + endif + endfunction + set stc=%0@MyClickFunc@%=%l%T + ]]) + meths.input_mouse('left', 'press', '', 0, 0, 0) + eq('0 1 l 4', eval("g:testvar")) + meths.input_mouse('left', 'press', '', 0, 0, 0) + eq('0 2 l 4', eval("g:testvar")) + meths.input_mouse('left', 'press', '', 0, 0, 0) + eq('0 3 l 4', eval("g:testvar")) + meths.input_mouse('left', 'press', '', 0, 0, 0) + eq('0 4 l 4', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 3, 0) + eq('0 1 r 7', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 3, 0) + eq('0 2 r 7', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 3, 0) + eq('0 3 r 7', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 3, 0) + eq('0 4 r 7', eval("g:testvar")) + command('set laststatus=2 winbar=%f') + command('let g:testvar=""') + -- Check that winbar click doesn't register as statuscolumn click + meths.input_mouse('right', 'press', '', 0, 0, 0) + eq('', eval("g:testvar")) + -- Check that statusline click doesn't register as statuscolumn click + meths.input_mouse('right', 'press', '', 0, 12, 0) + eq('', eval("g:testvar")) + -- Check that cmdline click doesn't register as statuscolumn click + meths.input_mouse('right', 'press', '', 0, 13, 0) + eq('', eval("g:testvar")) + end) + end it('click labels do not leak memory', function() command([[ diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index c41d4983a7..5ea4eade4e 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -12,178 +12,182 @@ local exec_lua = helpers.exec_lua local eval = helpers.eval local sleep = helpers.sleep -describe('statusline clicks', function() - local screen - - before_each(function() - clear() - screen = Screen.new(40, 8) - screen:attach() - command('set laststatus=2 mousemodel=extend') - exec([=[ - function! MyClickFunc(minwid, clicks, button, mods) - let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button) - if a:mods !=# ' ' - let g:testvar ..= '(' .. a:mods .. ')' - endif - endfunction - ]=]) - end) - - it('works', function() - meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') - meths.input_mouse('left', 'press', '', 0, 6, 17) - eq('0 1 l', eval("g:testvar")) - meths.input_mouse('left', 'press', '', 0, 6, 17) - eq('0 2 l', eval("g:testvar")) - meths.input_mouse('left', 'press', '', 0, 6, 17) - eq('0 3 l', eval("g:testvar")) - meths.input_mouse('left', 'press', '', 0, 6, 17) - eq('0 4 l', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 17) - eq('0 1 r', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 17) - eq('0 2 r', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 17) - eq('0 3 r', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 17) - eq('0 4 r', eval("g:testvar")) - end) - - it('works for winbar', function() - meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') - meths.input_mouse('left', 'press', '', 0, 0, 17) - eq('0 1 l', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 0, 17) - eq('0 1 r', eval("g:testvar")) - end) - - it('works for winbar in floating window', function() - meths.open_win(0, true, { width=30, height=4, relative='editor', row=1, col=5, - border = "single" }) - meths.set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', - { scope = 'local' }) - meths.input_mouse('left', 'press', '', 0, 2, 23) - eq('0 1 l', eval("g:testvar")) - end) - - it('works when there are multiple windows', function() - command('split') - meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') - meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') - meths.input_mouse('left', 'press', '', 0, 0, 17) - eq('0 1 l', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 4, 17) - eq('0 1 r', eval("g:testvar")) - meths.input_mouse('middle', 'press', '', 0, 3, 17) - eq('0 1 m', eval("g:testvar")) - meths.input_mouse('left', 'press', '', 0, 6, 17) - eq('0 1 l', eval("g:testvar")) - end) - - it('works with Lua function', function() - exec_lua([[ - function clicky_func(minwid, clicks, button, mods) - vim.g.testvar = string.format("%d %d %s", minwid, clicks, button) - end - ]]) - meths.set_option('statusline', 'Not clicky stuff %0@v:lua.clicky_func@Clicky stuff%T') - meths.input_mouse('left', 'press', '', 0, 6, 17) - eq('0 1 l', eval("g:testvar")) - end) - - it('ignores unsupported click items', function() - command('tabnew | tabprevious') - meths.set_option('statusline', '%2TNot clicky stuff%T') - meths.input_mouse('left', 'press', '', 0, 6, 0) - eq(1, meths.get_current_tabpage().id) - meths.set_option('statusline', '%2XNot clicky stuff%X') - meths.input_mouse('left', 'press', '', 0, 6, 0) - eq(2, #meths.list_tabpages()) - end) - - it("right click works when statusline isn't focused #18994", function() - meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') - meths.input_mouse('right', 'press', '', 0, 6, 17) - eq('0 1 r', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 17) - eq('0 2 r', eval("g:testvar")) - end) - - it("works with modifiers #18994", function() - meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') - -- Note: alternate between left and right mouse buttons to avoid triggering multiclicks - meths.input_mouse('left', 'press', 'S', 0, 6, 17) - eq('0 1 l(s )', eval("g:testvar")) - meths.input_mouse('right', 'press', 'S', 0, 6, 17) - eq('0 1 r(s )', eval("g:testvar")) - meths.input_mouse('left', 'press', 'A', 0, 6, 17) - eq('0 1 l( a )', eval("g:testvar")) - meths.input_mouse('right', 'press', 'A', 0, 6, 17) - eq('0 1 r( a )', eval("g:testvar")) - meths.input_mouse('left', 'press', 'AS', 0, 6, 17) - eq('0 1 l(s a )', eval("g:testvar")) - meths.input_mouse('right', 'press', 'AS', 0, 6, 17) - eq('0 1 r(s a )', eval("g:testvar")) - meths.input_mouse('left', 'press', 'T', 0, 6, 17) - eq('0 1 l( m)', eval("g:testvar")) - meths.input_mouse('right', 'press', 'T', 0, 6, 17) - eq('0 1 r( m)', eval("g:testvar")) - meths.input_mouse('left', 'press', 'TS', 0, 6, 17) - eq('0 1 l(s m)', eval("g:testvar")) - meths.input_mouse('right', 'press', 'TS', 0, 6, 17) - eq('0 1 r(s m)', eval("g:testvar")) - meths.input_mouse('left', 'press', 'C', 0, 6, 17) - eq('0 1 l( c )', eval("g:testvar")) - -- <C-RightMouse> is for tag jump - end) - - it("works for global statusline with vertical splits #19186", function() - command('set laststatus=3') - meths.set_option('statusline', '%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T') - command('vsplit') - screen:expect([[ - ^ │ | - ~ │~ | - ~ │~ | - ~ │~ | - ~ │~ | - ~ │~ | - Clicky stuff Clicky stuff| - | - ]]) - - -- clickable area on the right - meths.input_mouse('left', 'press', '', 0, 6, 35) - eq('0 1 l', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 35) - eq('0 1 r', eval("g:testvar")) - - -- clickable area on the left - meths.input_mouse('left', 'press', '', 0, 6, 5) - eq('0 1 l', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 5) - eq('0 1 r', eval("g:testvar")) - end) - - it('no memory leak with zero-width click labels', function() - command([[ - let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@' - ]]) - meths.input_mouse('left', 'press', '', 0, 6, 0) - eq('0 1 l', eval("g:testvar")) - meths.input_mouse('right', 'press', '', 0, 6, 39) - eq('0 1 r', eval("g:testvar")) - end) - - it('no memory leak with truncated click labels', function() - command([[ - let &stl = '%@MyClickFunc@foo%X' .. repeat('a', 40) .. '%<t%@Test@bar%X%@Test@baz' - ]]) - meths.input_mouse('left', 'press', '', 0, 6, 2) - eq('0 1 l', eval("g:testvar")) - end) -end) +local mousemodels = { "extend", "popup", "popup_setpos" } + +for _, model in ipairs(mousemodels) do + describe('statusline clicks with mousemodel=' .. model, function() + local screen + + before_each(function() + clear() + screen = Screen.new(40, 8) + screen:attach() + command('set laststatus=2 mousemodel=' .. model) + exec([=[ + function! MyClickFunc(minwid, clicks, button, mods) + let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button) + if a:mods !=# ' ' + let g:testvar ..= '(' .. a:mods .. ')' + endif + endfunction + ]=]) + end) + + it('works', function() + meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') + meths.input_mouse('left', 'press', '', 0, 6, 17) + eq('0 1 l', eval("g:testvar")) + meths.input_mouse('left', 'press', '', 0, 6, 17) + eq('0 2 l', eval("g:testvar")) + meths.input_mouse('left', 'press', '', 0, 6, 17) + eq('0 3 l', eval("g:testvar")) + meths.input_mouse('left', 'press', '', 0, 6, 17) + eq('0 4 l', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 17) + eq('0 1 r', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 17) + eq('0 2 r', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 17) + eq('0 3 r', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 17) + eq('0 4 r', eval("g:testvar")) + end) + + it('works for winbar', function() + meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') + meths.input_mouse('left', 'press', '', 0, 0, 17) + eq('0 1 l', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 0, 17) + eq('0 1 r', eval("g:testvar")) + end) + + it('works for winbar in floating window', function() + meths.open_win(0, true, { width=30, height=4, relative='editor', row=1, col=5, + border = "single" }) + meths.set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', + { scope = 'local' }) + meths.input_mouse('left', 'press', '', 0, 2, 23) + eq('0 1 l', eval("g:testvar")) + end) + + it('works when there are multiple windows', function() + command('split') + meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') + meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') + meths.input_mouse('left', 'press', '', 0, 0, 17) + eq('0 1 l', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 4, 17) + eq('0 1 r', eval("g:testvar")) + meths.input_mouse('middle', 'press', '', 0, 3, 17) + eq('0 1 m', eval("g:testvar")) + meths.input_mouse('left', 'press', '', 0, 6, 17) + eq('0 1 l', eval("g:testvar")) + end) + + it('works with Lua function', function() + exec_lua([[ + function clicky_func(minwid, clicks, button, mods) + vim.g.testvar = string.format("%d %d %s", minwid, clicks, button) + end + ]]) + meths.set_option('statusline', 'Not clicky stuff %0@v:lua.clicky_func@Clicky stuff%T') + meths.input_mouse('left', 'press', '', 0, 6, 17) + eq('0 1 l', eval("g:testvar")) + end) + + it('ignores unsupported click items', function() + command('tabnew | tabprevious') + meths.set_option('statusline', '%2TNot clicky stuff%T') + meths.input_mouse('left', 'press', '', 0, 6, 0) + eq(1, meths.get_current_tabpage().id) + meths.set_option('statusline', '%2XNot clicky stuff%X') + meths.input_mouse('left', 'press', '', 0, 6, 0) + eq(2, #meths.list_tabpages()) + end) + + it("right click works when statusline isn't focused #18994", function() + meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') + meths.input_mouse('right', 'press', '', 0, 6, 17) + eq('0 1 r', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 17) + eq('0 2 r', eval("g:testvar")) + end) + + it("works with modifiers #18994", function() + meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T') + -- Note: alternate between left and right mouse buttons to avoid triggering multiclicks + meths.input_mouse('left', 'press', 'S', 0, 6, 17) + eq('0 1 l(s )', eval("g:testvar")) + meths.input_mouse('right', 'press', 'S', 0, 6, 17) + eq('0 1 r(s )', eval("g:testvar")) + meths.input_mouse('left', 'press', 'A', 0, 6, 17) + eq('0 1 l( a )', eval("g:testvar")) + meths.input_mouse('right', 'press', 'A', 0, 6, 17) + eq('0 1 r( a )', eval("g:testvar")) + meths.input_mouse('left', 'press', 'AS', 0, 6, 17) + eq('0 1 l(s a )', eval("g:testvar")) + meths.input_mouse('right', 'press', 'AS', 0, 6, 17) + eq('0 1 r(s a )', eval("g:testvar")) + meths.input_mouse('left', 'press', 'T', 0, 6, 17) + eq('0 1 l( m)', eval("g:testvar")) + meths.input_mouse('right', 'press', 'T', 0, 6, 17) + eq('0 1 r( m)', eval("g:testvar")) + meths.input_mouse('left', 'press', 'TS', 0, 6, 17) + eq('0 1 l(s m)', eval("g:testvar")) + meths.input_mouse('right', 'press', 'TS', 0, 6, 17) + eq('0 1 r(s m)', eval("g:testvar")) + meths.input_mouse('left', 'press', 'C', 0, 6, 17) + eq('0 1 l( c )', eval("g:testvar")) + -- <C-RightMouse> is for tag jump + end) + + it("works for global statusline with vertical splits #19186", function() + command('set laststatus=3') + meths.set_option('statusline', '%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T') + command('vsplit') + screen:expect([[ + ^ │ | + ~ │~ | + ~ │~ | + ~ │~ | + ~ │~ | + ~ │~ | + Clicky stuff Clicky stuff| + | + ]]) + + -- clickable area on the right + meths.input_mouse('left', 'press', '', 0, 6, 35) + eq('0 1 l', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 35) + eq('0 1 r', eval("g:testvar")) + + -- clickable area on the left + meths.input_mouse('left', 'press', '', 0, 6, 5) + eq('0 1 l', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 5) + eq('0 1 r', eval("g:testvar")) + end) + + it('no memory leak with zero-width click labels', function() + command([[ + let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@' + ]]) + meths.input_mouse('left', 'press', '', 0, 6, 0) + eq('0 1 l', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 39) + eq('0 1 r', eval("g:testvar")) + end) + + it('no memory leak with truncated click labels', function() + command([[ + let &stl = '%@MyClickFunc@foo%X' .. repeat('a', 40) .. '%<t%@Test@bar%X%@Test@baz' + ]]) + meths.input_mouse('left', 'press', '', 0, 6, 2) + eq('0 1 l', eval("g:testvar")) + end) + end) +end describe('global statusline', function() local screen diff --git a/test/old/testdir/test_charsearch.vim b/test/old/testdir/test_charsearch.vim index f8f3e958ca..8d6b405743 100644 --- a/test/old/testdir/test_charsearch.vim +++ b/test/old/testdir/test_charsearch.vim @@ -39,7 +39,7 @@ func Test_charsearch() call setcharsearch({'char' : ''}) call assert_equal('', getcharsearch().char) - call assert_fails("call setcharsearch([])", 'E715:') + call assert_fails("call setcharsearch([])", 'E1206:') enew! endfunc diff --git a/test/old/testdir/test_expr.vim b/test/old/testdir/test_expr.vim index dee7266bb5..ff3dfb83cb 100644 --- a/test/old/testdir/test_expr.vim +++ b/test/old/testdir/test_expr.vim @@ -105,7 +105,7 @@ func Test_dict() END call CheckLegacyAndVim9Success(lines) - call CheckLegacyAndVim9Failure(["VAR i = has_key([], 'a')"], ['E715:', 'E1013:', 'E1206:']) + call CheckLegacyAndVim9Failure(["VAR i = has_key([], 'a')"], ['E1206:', 'E1013:', 'E1206:']) endfunc func Test_strgetchar() diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 7d3d74caad..a1f34ea8b6 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2007,7 +2007,7 @@ func Test_call() endfunction let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")} eval mydict.len->call([], mydict)->assert_equal(4) - call assert_fails("call call('Mylen', [], 0)", 'E715:') + call assert_fails("call call('Mylen', [], 0)", 'E1206:') call assert_fails('call foo', 'E107:') " These once caused a crash. @@ -2607,4 +2607,15 @@ func Test_builtin_check() endfunc +" Test for virtcol() +func Test_virtcol() + enew! + call setline(1, "the\tquick\tbrown\tfox") + norm! 4| + call assert_equal(8, virtcol('.')) + call assert_equal(8, virtcol('.', v:false)) + call assert_equal([4, 8], virtcol('.', v:true)) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index cbed71bb0a..0ff3582da9 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -699,7 +699,7 @@ func Test_reverse_sort_uniq() call assert_fails('call reverse("")', 'E899:') call assert_fails('call uniq([1, 2], {x, y -> []})', 'E745:') - call assert_fails("call sort([1, 2], function('min'), 1)", "E715:") + call assert_fails("call sort([1, 2], function('min'), 1)", "E1206:") call assert_fails("call sort([1, 2], function('invalid_func'))", "E700:") call assert_fails("call sort([1, 2], function('min'))", "E118:") endfunc diff --git a/test/old/testdir/test_maparg.vim b/test/old/testdir/test_maparg.vim index 19130c1569..12670671dd 100644 --- a/test/old/testdir/test_maparg.vim +++ b/test/old/testdir/test_maparg.vim @@ -270,7 +270,7 @@ func Test_mapset() bwipe! call assert_fails('call mapset([], v:false, {})', 'E730:') - call assert_fails('call mapset("i", 0, "")', 'E715:') + call assert_fails('call mapset("i", 0, "")', 'E1206:') call assert_fails('call mapset("i", 0, {})', 'E460:') endfunc diff --git a/test/old/testdir/test_matchfuzzy.vim b/test/old/testdir/test_matchfuzzy.vim index b46550fbc3..be5c629cf5 100644 --- a/test/old/testdir/test_matchfuzzy.vim +++ b/test/old/testdir/test_matchfuzzy.vim @@ -67,7 +67,7 @@ func Test_matchfuzzy() call assert_equal([{'id' : 6, 'val' : 'camera'}], matchfuzzy(l, 'cam', {'key' : 'val'})) call assert_equal([], matchfuzzy(l, 'day', {'text_cb' : {v -> v.val}})) call assert_equal([], matchfuzzy(l, 'day', {'key' : 'val'})) - call assert_fails("let x = matchfuzzy(l, 'cam', 'random')", 'E715:') + call assert_fails("let x = matchfuzzy(l, 'cam', 'random')", 'E1206:') call assert_equal([], matchfuzzy(l, 'day', {'text_cb' : {v -> []}})) call assert_equal([], matchfuzzy(l, 'day', {'text_cb' : {v -> 1}})) call assert_fails("let x = matchfuzzy(l, 'day', {'text_cb' : {a, b -> 1}})", 'E119:') @@ -76,7 +76,7 @@ func Test_matchfuzzy() " call assert_fails("let x = matchfuzzy(l, 'cam', {'text_cb' : []})", 'E921:') call assert_fails("let x = matchfuzzy(l, 'cam', {'text_cb' : []})", 'E6000:') call assert_fails("let x = matchfuzzy(l, 'foo', {'key' : []})", 'E730:') - call assert_fails("let x = matchfuzzy(l, 'cam', v:_null_dict)", 'E715:') + call assert_fails("let x = matchfuzzy(l, 'cam', v:_null_dict)", 'E1297:') call assert_fails("let x = matchfuzzy(l, 'foo', {'key' : v:_null_string})", 'E475:') " Nvim doesn't have null functions " call assert_fails("let x = matchfuzzy(l, 'foo', {'text_cb' : test_null_function()})", 'E475:') @@ -144,7 +144,7 @@ func Test_matchfuzzypos() \ matchfuzzypos(l, 'cam', {'key' : 'val'})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'text_cb' : {v -> v.val}})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'key' : 'val'})) - call assert_fails("let x = matchfuzzypos(l, 'cam', 'random')", 'E715:') + call assert_fails("let x = matchfuzzypos(l, 'cam', 'random')", 'E1206:') call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'text_cb' : {v -> []}})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'text_cb' : {v -> 1}})) call assert_fails("let x = matchfuzzypos(l, 'day', {'text_cb' : {a, b -> 1}})", 'E119:') @@ -153,7 +153,7 @@ func Test_matchfuzzypos() " call assert_fails("let x = matchfuzzypos(l, 'cam', {'text_cb' : []})", 'E921:') call assert_fails("let x = matchfuzzypos(l, 'cam', {'text_cb' : []})", 'E6000:') call assert_fails("let x = matchfuzzypos(l, 'foo', {'key' : []})", 'E730:') - call assert_fails("let x = matchfuzzypos(l, 'cam', v:_null_dict)", 'E715:') + call assert_fails("let x = matchfuzzypos(l, 'cam', v:_null_dict)", 'E1297:') call assert_fails("let x = matchfuzzypos(l, 'foo', {'key' : v:_null_string})", 'E475:') " Nvim doesn't have null functions " call assert_fails("let x = matchfuzzypos(l, 'foo', {'text_cb' : test_null_function()})", 'E475:') diff --git a/test/old/testdir/test_partial.vim b/test/old/testdir/test_partial.vim index 302bc22d93..8b62e4a0e5 100644 --- a/test/old/testdir/test_partial.vim +++ b/test/old/testdir/test_partial.vim @@ -86,7 +86,7 @@ func Test_partial_dict() call assert_equal("Hello", dict.tr()) call assert_fails("let F=function('setloclist', 10)", "E923:") - call assert_fails("let F=function('setloclist', [], [])", "E922:") + call assert_fails("let F=function('setloclist', [], [])", "E1206:") endfunc func Test_partial_implicit() diff --git a/test/old/testdir/test_search_stat.vim b/test/old/testdir/test_search_stat.vim index 1b2d854829..8dfc850956 100644 --- a/test/old/testdir/test_search_stat.vim +++ b/test/old/testdir/test_search_stat.vim @@ -259,7 +259,7 @@ func Test_search_stat() endfunc func Test_searchcount_fails() - call assert_fails('echo searchcount("boo!")', 'E715:') + call assert_fails('echo searchcount("boo!")', 'E1206:') call assert_fails('echo searchcount({"timeout" : []})', 'E745:') call assert_fails('echo searchcount({"maxcount" : []})', 'E745:') call assert_fails('echo searchcount({"pattern" : []})', 'E730:') diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 129f1c1a0c..9ecbde0f30 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -463,7 +463,7 @@ func Test_sign_funcs() call assert_fails('call sign_define("sign4", {"text" : "===>"})', 'E239:') " call assert_fails('call sign_define("sign5", {"text" : ""})', 'E239:') call assert_fails('call sign_define({})', 'E731:') - call assert_fails('call sign_define("sign6", [])', 'E715:') + call assert_fails('call sign_define("sign6", [])', 'E1206:') " Tests for sign_getdefined() call assert_equal([], sign_getdefined("none")) @@ -490,8 +490,7 @@ func Test_sign_funcs() " Tests for invalid arguments to sign_place() call assert_fails('call sign_place([], "", "mySign", 1)', 'E745:') call assert_fails('call sign_place(5, "", "mySign", -1)', 'E158:') - call assert_fails('call sign_place(-1, "", "sign1", "Xsign", [])', - \ 'E715:') + call assert_fails('call sign_place(-1, "", "sign1", "Xsign", [])', 'E1206:') call assert_fails('call sign_place(-1, "", "sign1", "Xsign", \ {"lnum" : 30})', 'E474:') call assert_fails('call sign_place(10, "", "xsign1x", "Xsign", @@ -526,7 +525,7 @@ func Test_sign_funcs() call assert_fails("call sign_getplaced('dummy.sign')", 'E158:') call assert_fails('call sign_getplaced("&")', 'E158:') call assert_fails('call sign_getplaced(-1)', 'E158:') - call assert_fails('call sign_getplaced("Xsign", [])', 'E715:') + call assert_fails('call sign_getplaced("Xsign", [])', 'E1206:') call assert_equal([{'bufnr' : bufnr(''), 'signs' : []}], \ sign_getplaced('Xsign', {'lnum' : 1000000})) call assert_fails("call sign_getplaced('Xsign', {'lnum' : []})", @@ -549,7 +548,7 @@ func Test_sign_funcs() \ {'id' : 20, 'buffer' : '&'})", 'E158:') call assert_fails("call sign_unplace('g1', \ {'id' : 20, 'buffer' : 200})", 'E158:') - call assert_fails("call sign_unplace('g1', 'mySign')", 'E715:') + call assert_fails("call sign_unplace('g1', 'mySign')", 'E1206:') call sign_unplace('*') @@ -1568,8 +1567,7 @@ func Test_sign_priority() \ s[0].signs) " Error case - call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', - \ [])", 'E715:') + call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', [])", 'E1206:') call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', \ {'priority' : []})", 'E745:') call sign_unplace('*') diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim index be60a3535c..3c646048f5 100644 --- a/test/old/testdir/test_tagjump.vim +++ b/test/old/testdir/test_tagjump.vim @@ -405,10 +405,10 @@ func Test_getsettagstack() " Error cases call assert_equal({}, gettagstack(100)) call assert_equal(-1, settagstack(100, {'items' : []})) - call assert_fails('call settagstack(1, [1, 10])', 'E715') - call assert_fails("call settagstack(1, {'items' : 10})", 'E714') - call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928') - call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962') + call assert_fails('call settagstack(1, [1, 10])', 'E1206:') + call assert_fails("call settagstack(1, {'items' : 10})", 'E714:') + call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928:') + call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962:') call assert_equal(-1, settagstack(0, v:_null_dict)) set tags=Xtags diff --git a/test/old/testdir/test_timers.vim b/test/old/testdir/test_timers.vim index f94ee6c9f3..b5781748bc 100644 --- a/test/old/testdir/test_timers.vim +++ b/test/old/testdir/test_timers.vim @@ -94,6 +94,12 @@ func Test_timer_info() call assert_equal([], timer_info(id)) call assert_fails('call timer_info("abc")', 'E39:') + + " check repeat count inside the callback + let g:timer_repeat = [] + let tid = timer_start(10, {tid -> execute("call add(g:timer_repeat, timer_info(tid)[0].repeat)")}, #{repeat: 3}) + call WaitForAssert({-> assert_equal([2, 1, 0], g:timer_repeat)}) + unlet g:timer_repeat endfunc func Test_timer_stopall() @@ -228,7 +234,7 @@ func Test_timer_errors() sleep 50m call assert_equal(3, g:call_count) - call assert_fails('call timer_start(100, "MyHandler", "abc")', 'E475:') + call assert_fails('call timer_start(100, "MyHandler", "abc")', 'E1206:') call assert_fails('call timer_start(100, [])', 'E921:') call assert_fails('call timer_stop("abc")', 'E39:') endfunc diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index 88135199fe..9320d67498 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -735,7 +735,7 @@ func Test_relative_cursor_position_in_one_line_window() only! bwipe! - call assert_fails('call winrestview(v:_null_dict)', 'E474:') + call assert_fails('call winrestview(v:_null_dict)', 'E1297:') endfunc func Test_relative_cursor_position_after_move_and_resize() @@ -936,7 +936,7 @@ func Test_winrestview() call assert_equal(view, winsaveview()) bwipe! - call assert_fails('call winrestview(v:_null_dict)', 'E474:') + call assert_fails('call winrestview(v:_null_dict)', 'E1297:') endfunc func Test_win_splitmove() @@ -967,7 +967,7 @@ func Test_win_splitmove() call assert_equal(bufname(winbufnr(2)), 'b') call assert_equal(bufname(winbufnr(3)), 'a') call assert_equal(bufname(winbufnr(4)), 'd') - call assert_fails('call win_splitmove(winnr(), winnr("k"), v:_null_dict)', 'E474:') + call assert_fails('call win_splitmove(winnr(), winnr("k"), v:_null_dict)', 'E1297:') only | bd call assert_fails('call win_splitmove(winnr(), 123)', 'E957:') diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua index 10b7594a88..8fa6378d10 100644 --- a/test/unit/helpers.lua +++ b/test/unit/helpers.lua @@ -97,7 +97,6 @@ local init = only_separate(function() for _, c in ipairs(child_calls_init) do c.func(unpack(c.args)) end - libnvim.time_init() libnvim.fs_init() libnvim.event_init() libnvim.early_init(nil) |