comparison src/testdir/test_usercommands.vim @ 19679:9199f34d838e v8.2.0396

patch 8.2.0396: cmdexpand.c insufficiently tested Commit: https://github.com/vim/vim/commit/24ebd83e030e1c6f9a6be1f06232756ba4d00a8c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 16 21:25:24 2020 +0100 patch 8.2.0396: cmdexpand.c insufficiently tested Problem: Cmdexpand.c insufficiently tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5789)
author Bram Moolenaar <Bram@vim.org>
date Mon, 16 Mar 2020 21:30:04 +0100
parents 854fb0ad4be6
children b3e93a05c3ca
comparison
equal deleted inserted replaced
19678:ef2d704798ba 19679:9199f34d838e
260 func CustomComplete(A, L, P) 260 func CustomComplete(A, L, P)
261 return "January\nFebruary\nMars\n" 261 return "January\nFebruary\nMars\n"
262 endfunc 262 endfunc
263 263
264 func CustomCompleteList(A, L, P) 264 func CustomCompleteList(A, L, P)
265 return [ "Monday", "Tuesday", "Wednesday" ] 265 return [ "Monday", "Tuesday", "Wednesday", {}]
266 endfunc 266 endfunc
267 267
268 func Test_CmdCompletion() 268 func Test_CmdCompletion()
269 call feedkeys(":com -\<C-A>\<C-B>\"\<CR>", 'tx') 269 call feedkeys(":com -\<C-A>\<C-B>\"\<CR>", 'tx')
270 call assert_equal('"com -addr bang bar buffer complete count nargs range register', @:) 270 call assert_equal('"com -addr bang bar buffer complete count nargs range register', @:)
325 com! -complete=custom,CustomCompleteList DoCmd : 325 com! -complete=custom,CustomCompleteList DoCmd :
326 call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E730:') 326 call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E730:')
327 327
328 com! -complete=customlist,CustomComp DoCmd : 328 com! -complete=customlist,CustomComp DoCmd :
329 call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:') 329 call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:')
330
331 " custom completion without a function
332 com! -complete=custom, DoCmd
333 call assert_beeps("call feedkeys(':DoCmd \t', 'tx')")
334
335 delcom DoCmd
330 endfunc 336 endfunc
331 337
332 func CallExecute(A, L, P) 338 func CallExecute(A, L, P)
333 " Drop first '\n' 339 " Drop first '\n'
334 return execute('echo "hi"')[1:] 340 return execute('echo "hi"')[1:]
540 546
541 comclear 547 comclear
542 call assert_equal("\nNo user-defined commands found", execute(':command Xxx')) 548 call assert_equal("\nNo user-defined commands found", execute(':command Xxx'))
543 call assert_equal("\nNo user-defined commands found", execute('command')) 549 call assert_equal("\nNo user-defined commands found", execute('command'))
544 endfunc 550 endfunc
551
552 " vim: shiftwidth=2 sts=2 expandtab