diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-25 21:47:45 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-25 21:47:45 +0100 |
commit | 8d588ccee57390aa01c2395fc599bbe6506ee13a (patch) | |
tree | 327836ed8bfb53b077dba03c311fce8539d067f6 /src/testdir/test_cmdline.vim | |
parent | c593bec4120f122e8a9129ec461968f1bd214435 (diff) |
patch 8.2.0316: ex_getln.c code has insufficient test coveragev8.2.0316
Problem: ex_getln.c code has insufficient test coverage.
Solution: Add more tests. Fix a problem. (Yegappan Lakshmanan, closes #5693)
Diffstat (limited to 'src/testdir/test_cmdline.vim')
-rw-r--r-- | src/testdir/test_cmdline.vim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 545f09b16f..fa3446ad1a 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -51,6 +51,12 @@ func Test_complete_wildmenu() call feedkeys(":e Xdir1/\<Tab>\<Down>\<Up>\<Right>\<CR>", 'tx') call assert_equal('testfile1', getline(1)) + " Completion using a relative path + cd Xdir1/Xdir2 + call feedkeys(":e ../\<Tab>\<Right>\<Down>\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"e Xtestfile3 Xtestfile4', @:) + cd - + " cleanup %bwipe call delete('Xdir1/Xdir2/Xtestfile4') @@ -456,6 +462,10 @@ func Test_cmdline_paste() " ignore error E32 endtry call assert_equal("Xtestfile", bufname("%")) + + " Use an invalid expression for <C-\>e + call assert_beeps('call feedkeys(":\<C-\>einvalid\<CR>", "tx")') + bwipe! endfunc @@ -690,6 +700,8 @@ func Test_getcmdtype() cnoremap <expr> <F6> Check_cmdline('=') call feedkeys("a\<C-R>=MyCmd a\<F6>\<Esc>\<Esc>", "xt") cunmap <F6> + + call assert_equal('', getcmdline()) endfunc func Test_getcmdwintype() @@ -930,6 +942,22 @@ func Test_cmdwin_cedit() delfunc CmdWinType endfunc +" Test for CmdwinEnter autocmd +func Test_cmdwin_autocmd() + augroup CmdWin + au! + autocmd CmdwinEnter * startinsert + augroup END + + call assert_fails('call feedkeys("q:xyz\<CR>", "xt")', 'E492:') + call assert_equal('xyz', @:) + + augroup CmdWin + au! + augroup END + augroup! CmdWin +endfunc + func Test_cmdlineclear_tabenter() CheckScreendump @@ -967,6 +995,10 @@ func Test_cmdwin_jump_to_win() call assert_equal(1, winnr('$')) call feedkeys("q/:exit\<CR>", "xt") call assert_equal(1, winnr('$')) + + " opening command window twice should fail + call assert_beeps('call feedkeys("q:q:\<CR>\<CR>", "xt")') + call assert_equal(1, winnr('$')) endfunc " Test for backtick expression in the command line @@ -1006,4 +1038,19 @@ func Test_cmd_bang() call delete('Xresult') endfunc +" Test for using ~ for home directory in cmdline completion matches +func Test_cmdline_expand_home() + call mkdir('Xdir') + call writefile([], 'Xdir/Xfile1') + call writefile([], 'Xdir/Xfile2') + cd Xdir + let save_HOME = $HOME + let $HOME = getcwd() + call feedkeys(":e ~/\<C-A>\<C-B>\"\<CR>", 'xt') + call assert_equal('"e ~/Xfile1 ~/Xfile2', @:) + let $HOME = save_HOME + cd .. + call delete('Xdir', 'rf') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |