aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-17 16:58:05 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-17 17:03:10 +0800
commit8ac9abd4fad5837c2cc7a858827efb2e53b852be (patch)
tree08cc7e0d3d47b7c5bb0e2f220021d5d44563e398 /test
parent1ed12a2e10708f0d4ce39e5adb94d189455f4d98 (diff)
downloadrneovim-8ac9abd4fad5837c2cc7a858827efb2e53b852be.tar.gz
rneovim-8ac9abd4fad5837c2cc7a858827efb2e53b852be.tar.bz2
rneovim-8ac9abd4fad5837c2cc7a858827efb2e53b852be.zip
vim-patch:9.0.1416: crash when collection is modified when using filter()
Problem: Crash when collection is modified when using filter(). Solution: Lock the list/dict/blob. (Ernie Rael, closes vim/vim#12183) https://github.com/vim/vim/commit/e6d40dcdc7227594935d2db01eca29f0e575dcee Co-authored-by: Ernie Rael <errael@raelity.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_filter_map.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/old/testdir/test_filter_map.vim b/test/old/testdir/test_filter_map.vim
index 3040b7b0d0..7658797759 100644
--- a/test/old/testdir/test_filter_map.vim
+++ b/test/old/testdir/test_filter_map.vim
@@ -109,6 +109,21 @@ func Test_map_and_modify()
let d = #{a: 1, b: 2, c: 3}
call assert_fails('call map(d, "remove(d, v:key)[0]")', 'E741:')
call assert_fails('echo map(d, {k,v -> remove(d, k)})', 'E741:')
+
+ let b = 0z1234
+ call assert_fails('call filter(b, "remove(b, 0)")', 'E741:')
+endfunc
+
+func Test_filter_and_modify()
+ let l = [0]
+ " cannot change the list halfway a map()
+ call assert_fails('call filter(l, "remove(l, 0)")', 'E741:')
+
+ let d = #{a: 0, b: 0, c: 0}
+ call assert_fails('call filter(d, "remove(d, v:key)")', 'E741:')
+
+ let b = 0z1234
+ call assert_fails('call filter(b, "remove(b, 0)")', 'E741:')
endfunc
func Test_mapnew_dict()