summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-11 19:12:04 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-11 19:12:04 +0200
commitcc7eb2aa7a7f2e6ae41f1e7cf60965c083d8a9e9 (patch)
tree5d54a35c88c61f041e7cdd16ba3ad9aa40a084ef /src/testdir
parent5231224e11bf468f5366a7400414368908c40795 (diff)
patch 8.2.3149: some plugins have a problem with the error checkv8.2.3149
Problem: Some plugins have a problem with the error check for using :command with -complete but without -nargs. Solution: In legacy script only give a warning message.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_usercommands.vim22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/testdir/test_usercommands.vim b/src/testdir/test_usercommands.vim
index 93312f1ecf..f0f056f88c 100644
--- a/src/testdir/test_usercommands.vim
+++ b/src/testdir/test_usercommands.vim
@@ -1,5 +1,7 @@
" Tests for user defined commands
+source vim9.vim
+
" Test for <mods> in user defined commands
function Test_cmdmods()
let g:mods = ''
@@ -270,13 +272,29 @@ func Test_CmdErrors()
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! -complete=file DoCmd :', 'E1208:')
- call assert_fails('com! -nargs=0 -complete=file DoCmd :', 'E1208:')
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! -complete=file DoCmd :
+ call assert_match('E1208:', v:warningmsg)
+ let v:warningmsg = ''
+ com! -nargs=0 -complete=file DoCmd :
+ call assert_match('E1208:', v:warningmsg)
+
+ let lines =<< trim END
+ vim9script
+ com! -complete=file DoCmd :
+ END
+ call CheckScriptFailure(lines, 'E1208', 2)
+
+ let lines =<< trim END
+ vim9script
+ com! -nargs=0 -complete=file DoCmd :
+ END
+ call CheckScriptFailure(lines, 'E1208', 2)
+
com! -nargs=0 DoCmd :
call assert_fails('DoCmd x', 'E488:')