diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-18 17:08:50 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-18 17:08:50 +0200 |
commit | ad2d4969e1616d3a0354c181e3a09271d5433b3d (patch) | |
tree | acbefd48d05e7164b98ed9a69e2cb0ccd6d2c8ff /src/testdir | |
parent | 0c35752d04f70408a3c560d5b3edbafcaddff302 (diff) |
patch 8.2.3177: Vim9: can not use "for _ in expr" at script levelv8.2.3177
Problem: Vim9: can not use "for _ in expr" at script level.
Solution: Skip assignment if the loop variable is "_".
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_script.vim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index bd06f7a2e9..592da6d0f9 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -2557,6 +2557,12 @@ def Test_for_loop() dd.counter = 12 endfor assert_equal([{a: 'Cat', counter: 12}], foo) + + reslist = [] + for _ in range(3) + reslist->add('x') + endfor + assert_equal(['x', 'x', 'x'], reslist) END CheckDefAndScriptSuccess(lines) enddef |