diff src/testdir/test_vim9_script.vim @ 19530:48e71f948360 v8.2.0322

patch 8.2.0322: Vim9: error checks not tested Commit: https://github.com/vim/vim/commit/b35efa5ed040162f5c988c71dfc1159045e47585 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 26 20:15:18 2020 +0100 patch 8.2.0322: Vim9: error checks not tested Problem: Vim9: error checks not tested. Solution: Add more test cases. Avoid error for function loaded later.
author Bram Moolenaar <Bram@vim.org>
date Wed, 26 Feb 2020 20:30:09 +0100
parents 3b026343f398
children b8f778dda1a1
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -178,6 +178,15 @@ func Test_call_default_args_from_func()
   call assert_fails('call MyDefaultArgs("one", "two")', 'E118:')
 endfunc
 
+func TakesOneArg(arg)
+  echo a:arg
+endfunc
+
+def Test_call_wrong_arg_count()
+  call CheckDefFailure(['TakesOneArg()'], 'E119:')
+  call CheckDefFailure(['TakesOneArg(11, 22)'], 'E118:')
+enddef
+
 " Default arg and varargs
 def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string
   let res = one .. ',' .. two
@@ -194,13 +203,12 @@ def Test_call_def_varargs()
   assert_equal('one,two,three', MyDefVarargs('one', 'two', 'three'))
 enddef
 
+def Test_call_func_defined_later()
+  call assert_equal('one', DefinedLater('one'))
+  call assert_fails('call NotDefined("one")', 'E117:')
+enddef
 
-"def Test_call_func_defined_later()
-"  call assert_equal('one', DefineLater('one'))
-"  call assert_fails('call NotDefined("one")', 'E99:')
-"enddef
-
-func DefineLater(arg)
+func DefinedLater(arg)
   return a:arg
 endfunc