# HG changeset patch # User Bram Moolenaar # Date 1582983003 -3600 # Node ID b3ef3538b3899059d3b5afd6df1b962b419c23d6 # Parent 640445ef649f3da7665653d21333e71c43f7a059 patch 8.2.0332: some code in ex_getln.c not covered by tests Commit: https://github.com/vim/vim/commit/d30ae2fc4acb3861fc7dc9618c1f90eee997d412 Author: Bram Moolenaar Date: Sat Feb 29 14:23:58 2020 +0100 patch 8.2.0332: some code in ex_getln.c not covered by tests Problem: Some code in ex_getln.c not covered by tests. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5710) diff --git a/src/testdir/test_arabic.vim b/src/testdir/test_arabic.vim --- a/src/testdir/test_arabic.vim +++ b/src/testdir/test_arabic.vim @@ -562,3 +562,26 @@ func Test_shape_combination_isolated() set arabicshape& bwipe! endfunc + +" Test for entering arabic character in a search command +func Test_arabic_chars_in_search_cmd() + new + set arabic + call feedkeys("i\nsghl!\vim\", 'tx') + call cursor(1, 1) + call feedkeys("/^sghl!\vim$\\", 'tx') + call assert_equal([2, 1], [line('.'), col('.')]) + + " Try searching in left-to-right mode + set rightleftcmd= + call cursor(1, 1) + call feedkeys("/^sghl!\vim$\", 'tx') + call assert_equal([2, 1], [line('.'), col('.')]) + + set rightleftcmd& + set rightleft& + set arabic& + bwipe! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim --- 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 e - call assert_beeps('call feedkeys(":\einvalid\", "tx")') - " Try to paste an invalid register using call feedkeys(":\"one\\two\", '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\\\\", 'xt') - call assert_equal("\"buffer", @:) + let str = ":one two\" + let str ..= "one two\\" + let str ..= "\five\" + let str ..= "\two " + let str ..= "\one " + let str ..= "\ three" + let str ..= "\\four " + let str ..= "\ six" + let str ..= "\\"\ seven\" + 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\" + let str ..= "one two\\" + let str ..= "\five\" + let str ..= "\two " + let str ..= "\one " + let str ..= "\ three" + let str ..= "\\four " + let str ..= "\ six" + let str ..= "\\"\ seven\" + 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 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\\e\"\\\"hello\"\\", 'xt') + call assert_equal('"hello', @:) + + " Use an invalid expression for e + call assert_beeps('call feedkeys(":\einvalid\", "tx")') + + " Insert literal in the command line + call feedkeys(":\"e \\\", 'xt') + call assert_equal("\"e \\", @:) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 332, +/**/ 331, /**/ 330,