aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-01-18 12:22:54 +0000
committerSean Dewar <seandewar@users.noreply.github.com>2022-01-18 12:49:30 +0000
commit1ae73e2d1c328a6181f4ebaebfc273e1d1c8d59d (patch)
treeacacb77f0f9a62fd140ef2d9a685ee57f3e5160e /src/nvim/testdir
parentfcf5dd34fdfde3a6632b96a88f66c1053cba08d1 (diff)
downloadrneovim-1ae73e2d1c328a6181f4ebaebfc273e1d1c8d59d.tar.gz
rneovim-1ae73e2d1c328a6181f4ebaebfc273e1d1c8d59d.tar.bz2
rneovim-1ae73e2d1c328a6181f4ebaebfc273e1d1c8d59d.zip
vim-patch:8.2.0175: crash when removing list element in map()
Problem: Crash when removing list element in map(). Solution: Lock the list. (closes vim/vim#2652) https://github.com/vim/vim/commit/db661fb95dc41b7a9438cf3cd4e77f8410bc81c0
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_filter_map.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_filter_map.vim b/src/nvim/testdir/test_filter_map.vim
index a52a66ac2f..1cd3a2287b 100644
--- a/src/nvim/testdir/test_filter_map.vim
+++ b/src/nvim/testdir/test_filter_map.vim
@@ -88,4 +88,14 @@ func Test_map_filter_fails()
call assert_fails("let l = filter('abc', '\"> \" . v:val')", 'E896:')
endfunc
+func Test_map_and_modify()
+ let l = ["abc"]
+ " cannot change the list halfway a map()
+ call assert_fails('call map(l, "remove(l, 0)[0]")', 'E741:')
+
+ 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:')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab