diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-29 14:23:58 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-29 14:23:58 +0100 |
commit | d30ae2fc4acb3861fc7dc9618c1f90eee997d412 (patch) | |
tree | 747555451d703f87262a46867fe178e0651b7616 /src/testdir/test_cmdline.vim | |
parent | 7c215c58936cbebd4132ad6112d04db54b7c153e (diff) | |
download | vim-git-d30ae2fc4acb3861fc7dc9618c1f90eee997d412.tar.gz |
patch 8.2.0332: some code in ex_getln.c not covered by testsv8.2.0332
Problem: Some code in ex_getln.c not covered by tests.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes #5710)
Diffstat (limited to 'src/testdir/test_cmdline.vim')
-rw-r--r-- | src/testdir/test_cmdline.vim | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index f61d4aeab..1baed7961 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -473,9 +473,6 @@ func Test_cmdline_paste() endtry call assert_equal("Xtestfile", bufname("%")) - " Use an invalid expression for <C-\>e - call assert_beeps('call feedkeys(":\<C-\>einvalid\<CR>", "tx")') - " Try to paste an invalid register using <C-R> call feedkeys(":\"one\<C-R>\<C-X>two\<CR>", 'xt') call assert_equal('"onetwo', @:) @@ -1176,9 +1173,53 @@ func Test_interrupt_compl() set wildmode& endfunc +" Test for moving the cursor on the : command line func Test_cmdline_edit() - call feedkeys(":\"buffer\<Right>\<Home>\<Left>\<CR>", 'xt') - call assert_equal("\"buffer", @:) + let str = ":one two\<C-U>" + let str ..= "one two\<C-W>\<C-W>" + let str ..= "\<Left>five\<Right>" + let str ..= "\<Home>two " + let str ..= "\<C-Left>one " + let str ..= "\<C-Right> three" + let str ..= "\<End>\<S-Left>four " + let str ..= "\<S-Right> six" + let str ..= "\<C-B>\"\<C-E> seven\<CR>" + call feedkeys(str, 'xt') + call assert_equal("\"one two three four five six seven", @:) +endfunc + +" Test for moving the cursor on the / command line in 'rightleft' mode +func Test_cmdline_edit_rightleft() + CheckFeature rightleft + set rightleft + set rightleftcmd=search + let str = "/one two\<C-U>" + let str ..= "one two\<C-W>\<C-W>" + let str ..= "\<Right>five\<Left>" + let str ..= "\<Home>two " + let str ..= "\<C-Right>one " + let str ..= "\<C-Left> three" + let str ..= "\<End>\<S-Right>four " + let str ..= "\<S-Left> six" + let str ..= "\<C-B>\"\<C-E> seven\<CR>" + call assert_fails("call feedkeys(str, 'xt')", 'E486:') + call assert_equal("\"one two three four five six seven", @/) + set rightleftcmd& + set rightleft& +endfunc + +" Test for using <C-\>e in the command line to evaluate an expression +func Test_cmdline_expr() + " Evaluate an expression from the beginning of a command line + call feedkeys(":abc\<C-B>\<C-\>e\"\\\"hello\"\<CR>\<CR>", 'xt') + call assert_equal('"hello', @:) + + " Use an invalid expression for <C-\>e + call assert_beeps('call feedkeys(":\<C-\>einvalid\<CR>", "tx")') + + " Insert literal <CTRL-\> in the command line + call feedkeys(":\"e \<C-\>\<C-Y>\<CR>", 'xt') + call assert_equal("\"e \<C-\>\<C-Y>", @:) endfunc " vim: shiftwidth=2 sts=2 expandtab |