diff src/testdir/test_vim9_func.vim @ 24695:13efbfc53054 v8.2.2886

patch 8.2.2886: various pieces of code not covered by tests Commit: https://github.com/vim/vim/commit/34fcb697240c1bc9e69417ed75db3b1a83479724 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue May 25 20:14:00 2021 +0200 patch 8.2.2886: various pieces of code not covered by tests Problem: Various pieces of code not covered by tests. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8255)
author Bram Moolenaar <Bram@vim.org>
date Tue, 25 May 2021 20:15:03 +0200
parents 04205b7d67d5
children 7464d4c927f5
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -397,6 +397,7 @@ def Test_call_default_args()
   delfunc g:Func
   CheckScriptFailure(['def Func(arg: number = "text")', 'enddef', 'defcompile'], 'E1013: Argument 1: type mismatch, expected number but got string')
   delfunc g:Func
+  CheckDefFailure(['def Func(x: number = )', 'enddef'], 'E15:')
 
   lines =<< trim END
       vim9script
@@ -1315,6 +1316,8 @@ def Test_arg_type_wrong()
   CheckScriptFailure(['def Func4(...)', 'echo "a"', 'enddef'], 'E1055: Missing name after ...')
   CheckScriptFailure(['def Func5(items:string)', 'echo "a"'], 'E1069:')
   CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:')
+  CheckScriptFailure(['def Func6(...x:list<number>)', 'echo "a"', 'enddef'], 'E1069:')
+  CheckScriptFailure(['def Func7(...x: int)', 'echo "a"', 'enddef'], 'E1010:')
 enddef
 
 def Test_white_space_before_comma()
@@ -2717,6 +2720,11 @@ def Test_ignored_argument()
       var _ = 1
   END
   CheckDefAndScriptFailure(lines, 'E1181:', 1)
+
+  lines =<< trim END
+      var x = _
+  END
+  CheckDefAndScriptFailure(lines, 'E1181:', 1)
 enddef
 
 def Test_too_many_arguments()