patch 9.1.0415: Some functions are not tested
Problem: Some functions are not tested
Solution: Add a few more tests, fix a few minor problems
(Yegappan Lakshmanan)
closes: #14789
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 2c3c47f..f07c4c9 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2512,6 +2512,13 @@
assert_equal(['x', 'x', 'x'], reslist)
END
v9.CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
+ for i : number : [1, 2]
+ echo i
+ endfor
+ END
+ v9.CheckSourceDefAndScriptFailure(lines, 'E1059: No white space allowed before colon: : [1, 2]', 1)
enddef
def Test_for_loop_list_of_lists()
@@ -5096,6 +5103,13 @@
var Fn = <funcx(number, number): number>b
END
v9.CheckSourceFailure(lines, 'E1010: Type not recognized: funcx(number, number): number', 2)
+
+ # Wrong type in a type cast
+ lines =<< trim END
+ vim9script
+ var i: number = <number>true
+ END
+ v9.CheckSourceFailure(lines, 'E1012: Type mismatch; expected number but got bool', 2)
enddef
" Keep this last, it messes up highlighting.