diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-28 15:46:53 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-02-28 16:51:31 +0800 |
commit | 0ded757c31bf02d6cd27fc7b580e85ff7953604e (patch) | |
tree | 60a80746156da35e0a78d6c71cc5a2b550db9813 | |
parent | 66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c (diff) | |
download | rneovim-0ded757c31bf02d6cd27fc7b580e85ff7953604e.tar.gz rneovim-0ded757c31bf02d6cd27fc7b580e85ff7953604e.tar.bz2 rneovim-0ded757c31bf02d6cd27fc7b580e85ff7953604e.zip |
vim-patch:8.2.2780: Vim9: for loop over blob doesn't work
Problem: Vim9: for loop over blob doesn't work.
Solution: Make it work.
https://github.com/vim/vim/commit/d551d6c268e435e2fbba22775510fbd0a54477f6
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/testdir/test_blob.vim | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/src/nvim/testdir/test_blob.vim b/src/nvim/testdir/test_blob.vim index e9d694e4c6..454be05363 100644 --- a/src/nvim/testdir/test_blob.vim +++ b/src/nvim/testdir/test_blob.vim @@ -283,33 +283,36 @@ func Test_blob_index_assign() endfunc func Test_blob_for_loop() - let blob = 0z00010203 - let i = 0 - for byte in blob - call assert_equal(i, byte) - let i += 1 - endfor - call assert_equal(4, i) - - let blob = 0z00 - call remove(blob, 0) - call assert_equal(0, len(blob)) - for byte in blob - call assert_error('loop over empty blob') - endfor - - let blob = 0z0001020304 - let i = 0 - for byte in blob - call assert_equal(i, byte) - if i == 1 + let lines =<< trim END + VAR blob = 0z00010203 + VAR i = 0 + for byte in blob + call assert_equal(i, byte) + LET i += 1 + endfor + call assert_equal(4, i) + + LET blob = 0z00 call remove(blob, 0) - elseif i == 3 - call remove(blob, 3) - endif - let i += 1 - endfor - call assert_equal(5, i) + call assert_equal(0, len(blob)) + for byte in blob + call assert_report('loop over empty blob') + endfor + + LET blob = 0z0001020304 + LET i = 0 + for byte in blob + call assert_equal(i, byte) + if i == 1 + call remove(blob, 0) + elseif i == 3 + call remove(blob, 3) + endif + LET i += 1 + endfor + call assert_equal(5, i) + END + call CheckLegacyAndVim9Success(lines) endfunc func Test_blob_concatenate() |