aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-12-06 22:43:59 +0000
committerzeertzjq <zeertzjq@outlook.com>2022-01-31 17:38:57 +0800
commit44a5875b24f033c472af50aa4eec4468c554b7c9 (patch)
tree4b0db4b8a79b51062e99f8a9b28f5b836d16cf4d /src/nvim/testdir
parentaf0bae38e286c7139f56307e318fa9818218c3d2 (diff)
downloadrneovim-44a5875b24f033c472af50aa4eec4468c554b7c9.tar.gz
rneovim-44a5875b24f033c472af50aa4eec4468c554b7c9.tar.bz2
rneovim-44a5875b24f033c472af50aa4eec4468c554b7c9.zip
vim-patch:8.2.1051: crash when changing a list while using reduce() on it
Problem: Crash when changing a list while using reduce() on it. Solution: Lock the list. (closes vim/vim#6330) https://github.com/vim/vim/commit/ca275a05d8b79f6a9101604fdede2373d0dea44e
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_listdict.vim9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_listdict.vim b/src/nvim/testdir/test_listdict.vim
index 42b46fc76c..fdf9123d82 100644
--- a/src/nvim/testdir/test_listdict.vim
+++ b/src/nvim/testdir/test_listdict.vim
@@ -649,6 +649,15 @@ func Test_reduce()
call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E897:')
call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E897:')
call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E897:')
+
+ let g:lut = [1, 2, 3, 4]
+ func EvilRemove()
+ call remove(g:lut, 1)
+ return 1
+ endfunc
+ call assert_fails("call reduce(g:lut, { acc, val -> EvilRemove() }, 1)", 'E742:')
+ unlet g:lut
+ delfunc EvilRemove
endfunc
" splitting a string to a List