comparison src/testdir/test_cmdline.vim @ 19550:b3ef3538b389 v8.2.0332

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 <Bram@vim.org> 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)
author Bram Moolenaar <Bram@vim.org>
date Sat, 29 Feb 2020 14:30:03 +0100
parents bab20768e1fd
children ff5048b0ccfe
comparison
equal deleted inserted replaced
19549:640445ef649f 19550:b3ef3538b389
471 catch /^Vim\%((\a\+)\)\=:E32/ 471 catch /^Vim\%((\a\+)\)\=:E32/
472 " ignore error E32 472 " ignore error E32
473 endtry 473 endtry
474 call assert_equal("Xtestfile", bufname("%")) 474 call assert_equal("Xtestfile", bufname("%"))
475 475
476 " Use an invalid expression for <C-\>e
477 call assert_beeps('call feedkeys(":\<C-\>einvalid\<CR>", "tx")')
478
479 " Try to paste an invalid register using <C-R> 476 " Try to paste an invalid register using <C-R>
480 call feedkeys(":\"one\<C-R>\<C-X>two\<CR>", 'xt') 477 call feedkeys(":\"one\<C-R>\<C-X>two\<CR>", 'xt')
481 call assert_equal('"onetwo', @:) 478 call assert_equal('"onetwo', @:)
482 479
483 let @a = "xy\<C-H>z" 480 let @a = "xy\<C-H>z"
1174 delcommand Tcmd 1171 delcommand Tcmd
1175 delfunc F 1172 delfunc F
1176 set wildmode& 1173 set wildmode&
1177 endfunc 1174 endfunc
1178 1175
1176 " Test for moving the cursor on the : command line
1179 func Test_cmdline_edit() 1177 func Test_cmdline_edit()
1180 call feedkeys(":\"buffer\<Right>\<Home>\<Left>\<CR>", 'xt') 1178 let str = ":one two\<C-U>"
1181 call assert_equal("\"buffer", @:) 1179 let str ..= "one two\<C-W>\<C-W>"
1180 let str ..= "\<Left>five\<Right>"
1181 let str ..= "\<Home>two "
1182 let str ..= "\<C-Left>one "
1183 let str ..= "\<C-Right> three"
1184 let str ..= "\<End>\<S-Left>four "
1185 let str ..= "\<S-Right> six"
1186 let str ..= "\<C-B>\"\<C-E> seven\<CR>"
1187 call feedkeys(str, 'xt')
1188 call assert_equal("\"one two three four five six seven", @:)
1189 endfunc
1190
1191 " Test for moving the cursor on the / command line in 'rightleft' mode
1192 func Test_cmdline_edit_rightleft()
1193 CheckFeature rightleft
1194 set rightleft
1195 set rightleftcmd=search
1196 let str = "/one two\<C-U>"
1197 let str ..= "one two\<C-W>\<C-W>"
1198 let str ..= "\<Right>five\<Left>"
1199 let str ..= "\<Home>two "
1200 let str ..= "\<C-Right>one "
1201 let str ..= "\<C-Left> three"
1202 let str ..= "\<End>\<S-Right>four "
1203 let str ..= "\<S-Left> six"
1204 let str ..= "\<C-B>\"\<C-E> seven\<CR>"
1205 call assert_fails("call feedkeys(str, 'xt')", 'E486:')
1206 call assert_equal("\"one two three four five six seven", @/)
1207 set rightleftcmd&
1208 set rightleft&
1209 endfunc
1210
1211 " Test for using <C-\>e in the command line to evaluate an expression
1212 func Test_cmdline_expr()
1213 " Evaluate an expression from the beginning of a command line
1214 call feedkeys(":abc\<C-B>\<C-\>e\"\\\"hello\"\<CR>\<CR>", 'xt')
1215 call assert_equal('"hello', @:)
1216
1217 " Use an invalid expression for <C-\>e
1218 call assert_beeps('call feedkeys(":\<C-\>einvalid\<CR>", "tx")')
1219
1220 " Insert literal <CTRL-\> in the command line
1221 call feedkeys(":\"e \<C-\>\<C-Y>\<CR>", 'xt')
1222 call assert_equal("\"e \<C-\>\<C-Y>", @:)
1182 endfunc 1223 endfunc
1183 1224
1184 " vim: shiftwidth=2 sts=2 expandtab 1225 " vim: shiftwidth=2 sts=2 expandtab