Mercurial > vim
diff src/testdir/test_menu.vim @ 19517:738a4fe2c8c5 v8.2.0316
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Commit: https://github.com/vim/vim/commit/8d588ccee57390aa01c2395fc599bbe6506ee13a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 25 21:47:45 2020 +0100
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Problem: ex_getln.c code has insufficient test coverage.
Solution: Add more tests. Fix a problem. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5693)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 25 Feb 2020 22:00:04 +0100 |
parents | 5bef1043abff |
children | da791e5c0139 |
line wrap: on
line diff
--- a/src/testdir/test_menu.vim +++ b/src/testdir/test_menu.vim @@ -88,3 +88,39 @@ func Test_menu_commands() unlet g:did_menu endfun + +" Test for menu item completion in command line +func Test_menu_expand() + " Create the menu itmes for test + for i in range(1, 4) + let m = 'menu Xmenu.A' .. i .. '.A' .. i + for j in range(1, 4) + exe m .. 'B' .. j .. ' :echo "A' .. i .. 'B' .. j .. '"' .. "<CR>" + endfor + endfor + set wildmenu + + " Test for <CR> selecting a submenu + call feedkeys(":emenu Xmenu.A\<Tab>\<CR>\<Right>x\<BS>\<C-B>\"\<CR>", 'xt') + call assert_equal('"emenu Xmenu.A1.A1B2', @:) + + " Test for <Down> selecting a submenu + call feedkeys(":emenu Xmenu.A\<Tab>\<Right>\<Right>\<Down>" .. + \ "\<C-A>\<C-B>\"\<CR>", 'xt') + call assert_equal('"emenu Xmenu.A3.A3B1 A3B2 A3B3 A3B4', @:) + + " Test for <Up> to go up a submenu + call feedkeys(":emenu Xmenu.A\<Tab>\<Down>\<Up>\<Right>\<Right>" .. + \ "\<Left>\<Down>\<C-A>\<C-B>\"\<CR>", 'xt') + call assert_equal('"emenu Xmenu.A2.A2B1 A2B2 A2B3 A2B4', @:) + + " Test for <Up> to go up a menu + call feedkeys(":emenu Xmenu.A\<Tab>\<Down>\<Up>\<Up>\<Up>" .. + \ "\<C-A>\<C-B>\"\<CR>", 'xt') + call assert_equal('"emenu Buffers. Xmenu.', @:) + + set wildmenu& + unmenu Xmenu +endfunc + +" vim: shiftwidth=2 sts=2 expandtab