diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-18 22:25:29 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-18 22:25:29 +0200 |
commit | 885971e2f5eabc4108e083086c1d6d0a31a2782f (patch) | |
tree | 4ecfebdc5ea8ca8c6274b76255bc06c007f9a440 /src/testdir | |
parent | 9ff9c7b9741b216d3dc75603e50654088dc5f55b (diff) |
patch 8.2.3182: Vim9: crash when using removing items from a constant listv8.2.3182
Problem: Vim9: crash when using removing items from a constant list.
(Yegappan Lakshmanan)
Solution: When a list was allocated with items copy them.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 638d7daa13..76987b68a3 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -2083,6 +2083,12 @@ def Test_remote_startserver() CheckDefFailure(['remote_startserver({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>') enddef +def Test_remove_const_list() + var l: list<number> = [1, 2, 3, 4] + assert_equal([1, 2], remove(l, 0, 1)) + assert_equal([3, 4], l) +enddef + def Test_remove_return_type() var l = remove({one: [1, 2], two: [3, 4]}, 'one') var res = 0 |