patch 9.1.0419: eval.c not sufficiently tested
Problem: eval.c not sufficiently tested
Solution: Add a few more additional tests for eval.c,
(Yegappan Lakshmanan)
closes: #14799
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 f07c4c9..a640fce 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2510,6 +2510,11 @@
reslist->add('x')
endfor
assert_equal(['x', 'x', 'x'], reslist)
+
+ # Test for trying to use the loop variable "_" inside the loop
+ for _ in "a"
+ assert_fails('echo _', 'E1181: Cannot use an underscore here')
+ endfor
END
v9.CheckDefAndScriptSuccess(lines)