Patch 8.0.0242
Problem:    Completion of user defined functions is not covered by tests.
Solution:   Add tests.  Also test various errors of user-defined commands.
            (Dominique Pelle, closes #1413)
Files:      src/testdir/test_usercommands.vim


*** ../vim-8.0.0241/src/testdir/test_usercommands.vim   2016-07-30 
19:35:38.000000000 +0200
--- src/testdir/test_usercommands.vim   2017-01-26 22:05:44.127512506 +0100
***************
*** 102,104 ****
--- 102,208 ----
    call assert_fails('Dothat', 'E492:')
    call assert_equal('yes', g:didnot)
  endfunc
+ 
+ func Test_CmdErrors()
+   call assert_fails('com! docmd :', 'E183:')
+   call assert_fails('com! \<Tab> :', 'E182:')
+   call assert_fails('com! _ :', 'E182:')
+   call assert_fails('com! X :', 'E841:')
+   call assert_fails('com! - DoCmd :', 'E175:')
+   call assert_fails('com! -xxx DoCmd :', 'E181:')
+   call assert_fails('com! -addr DoCmd :', 'E179:')
+   call assert_fails('com! -complete DoCmd :', 'E179:')
+   call assert_fails('com! -complete=xxx DoCmd :', 'E180:')
+   call assert_fails('com! -complete=custom DoCmd :', 'E467:')
+   call assert_fails('com! -complete=customlist DoCmd :', 'E467:')
+   call assert_fails('com! -complete=behave,CustomComplete DoCmd :', 'E468:')
+   call assert_fails('com! -nargs=x DoCmd :', 'E176:')
+   call assert_fails('com! -count=1 -count=2 DoCmd :', 'E177:')
+   call assert_fails('com! -count=x DoCmd :', 'E178:')
+   call assert_fails('com! -range=x DoCmd :', 'E178:')
+ 
+   com! -nargs=0 DoCmd :
+   call assert_fails('DoCmd x', 'E488:')
+ 
+   com! -nargs=1 DoCmd :
+   call assert_fails('DoCmd', 'E471:')
+ 
+   com! -nargs=+ DoCmd :
+   call assert_fails('DoCmd', 'E471:')
+ 
+   call assert_fails('com DoCmd :', 'E174:')
+   comclear
+   call assert_fails('delcom DoCmd', 'E184:')
+ endfunc
+ 
+ func CustomComplete(A, L, P)
+   return "January\nFebruary\nMars\n"
+ endfunc
+ 
+ func CustomCompleteList(A, L, P)
+   return [ "Monday", "Tuesday", "Wednesday" ]
+ endfunc
+ 
+ func Test_CmdCompletion()
+   call feedkeys(":com -\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com -addr bang bar buffer complete count nargs range 
register', @:)
+ 
+   call feedkeys(":com -nargs=0 -\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com -nargs=0 -addr bang bar buffer complete count nargs 
range register', @:)
+ 
+   call feedkeys(":com -nargs=\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com -nargs=* + 0 1 ?', @:)
+ 
+   call feedkeys(":com -addr=\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com -addr=arguments buffers lines loaded_buffers 
quickfix tabs windows', @:)
+ 
+   call feedkeys(":com -complete=co\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com -complete=color command compiler', @:)
+ 
+   command! DoCmd1 :
+   command! DoCmd2 :
+   call feedkeys(":com \<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com DoCmd1 DoCmd2', @:)
+ 
+   call feedkeys(":DoC\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"DoCmd1 DoCmd2', @:)
+ 
+   call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"delcom DoCmd1 DoCmd2', @:)
+ 
+   delcom DoCmd1
+   call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"delcom DoCmd2', @:)
+ 
+   call feedkeys(":com DoC\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com DoCmd2', @:)
+ 
+   delcom DoCmd2
+   call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"delcom DoC', @:)
+ 
+   call feedkeys(":com DoC\<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"com DoC', @:)
+ 
+   com! -complete=behave DoCmd :
+   call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"DoCmd mswin xterm', @:)
+ 
+   " This does not work. Why?
+   "call feedkeys(":DoCmd x\<C-A>\<C-B>\"\<CR>", 'tx')
+   "call assert_equal('"DoCmd xterm', @:)
+ 
+   com! -complete=custom,CustomComplete DoCmd :
+   call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"DoCmd January February Mars', @:)
+ 
+   com! -complete=customlist,CustomCompleteList DoCmd :
+   call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"DoCmd Monday Tuesday Wednesday', @:)
+ 
+   com! -complete=custom,CustomCompleteList DoCmd :
+   call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E730:')
+ 
+   com! -complete=customlist,CustomComp DoCmd :
+   call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:')
+ endfunc
*** ../vim-8.0.0241/src/version.c       2017-01-26 21:36:29.610733183 +0100
--- src/version.c       2017-01-26 22:06:09.259351700 +0100
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     242,
  /**/

-- 
Q: How does a UNIX Guru pick up a girl?
A: look; grep; which; eval; nice; uname; talk; date;

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui