aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-07-29 20:25:46 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-15 22:30:31 +0100
commit23f5999d28cdee049661ed38e22812a063e78fad (patch)
tree92de335089813184df2704ea65aea2f664da04a5 /src/nvim/testdir
parente140eec441006d0a05abcba49c6d9a0482609216 (diff)
downloadrneovim-23f5999d28cdee049661ed38e22812a063e78fad.tar.gz
rneovim-23f5999d28cdee049661ed38e22812a063e78fad.tar.bz2
rneovim-23f5999d28cdee049661ed38e22812a063e78fad.zip
vim-patch:8.1.0798: changing a blob while iterating over it works strangely
Problem: Changing a blob while iterating over it works strangely. Solution: Make a copy of the Blob before iterating. https://github.com/vim/vim/commit/dd29ea18050284526174b5685781469240f5bc4a
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_blob.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_blob.vim b/src/nvim/testdir/test_blob.vim
index 08342e35d2..568821f564 100644
--- a/src/nvim/testdir/test_blob.vim
+++ b/src/nvim/testdir/test_blob.vim
@@ -154,6 +154,7 @@ func Test_blob_for_loop()
call assert_equal(i, byte)
let i += 1
endfor
+ call assert_equal(4, i)
let blob = 0z00
call remove(blob, 0)
@@ -161,6 +162,19 @@ func Test_blob_for_loop()
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
+ call remove(blob, 0)
+ elseif i == 3
+ call remove(blob, 3)
+ endif
+ let i += 1
+ endfor
+ call assert_equal(5, i)
endfunc
func Test_blob_concatenate()