summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_eval_stuff.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:15 +0000
commit6e9cd6b491267e6dff3e3f3f37d8af5f28e40672 (patch)
tree35661af16c4a0ef2a9a8e225d2d5cc82605ea289 /src/testdir/test_eval_stuff.vim
parentAdding upstream version 2:9.1.0496. (diff)
downloadvim-6e9cd6b491267e6dff3e3f3f37d8af5f28e40672.tar.xz
vim-6e9cd6b491267e6dff3e3f3f37d8af5f28e40672.zip
Adding upstream version 2:9.1.0698.upstream/2%9.1.0698
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir/test_eval_stuff.vim')
-rw-r--r--src/testdir/test_eval_stuff.vim27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index a346399..1b17108 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -2,6 +2,7 @@
source view_util.vim
source shared.vim
+import './vim9.vim' as v9
function s:foo() abort
try
@@ -126,7 +127,31 @@ func Test_for_invalid()
call assert_fails("for x in 99", 'E1098:')
call assert_fails("for x in function('winnr')", 'E1098:')
call assert_fails("for x in {'a': 9}", 'E1098:')
- call assert_fails("for v:maxcol in range(1)", 'E46:')
+
+ let lines =<< trim END
+ for v:maxcol in range(5)
+ endfor
+ END
+
+ let save_v_maxcol = v:maxcol
+ call v9.CheckLegacyAndVim9Failure(lines, 'E46:')
+ call assert_equal(save_v_maxcol, v:maxcol)
+
+ let lines =<< trim END
+ for g:constvar in range(5)
+ endfor
+ END
+
+ const g:constvar = 10
+ call v9.CheckLegacyAndVim9Failure(lines, 'E741:')
+ call assert_equal(10, g:constvar)
+ unlet g:constvar
+
+ let g:constvar = 10
+ lockvar 0 g:constvar
+ call v9.CheckLegacyAndVim9Failure(lines, 'E1122:')
+ call assert_equal(10, g:constvar)
+ unlet g:constvar
if 0
/1/5/2/s/\n