Mercurial > vim
comparison src/testdir/test_vim9_builtin.vim @ 25290:8b7ea875afed v8.2.3182
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Commit: https://github.com/vim/vim/commit/885971e2f5eabc4108e083086c1d6d0a31a2782f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 18 22:25:29 2021 +0200
patch 8.2.3182: Vim9: crash when using removing items from a constant list
Problem: Vim9: crash when using removing items from a constant list.
(Yegappan Lakshmanan)
Solution: When a list was allocated with items copy them.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 18 Jul 2021 22:30:03 +0200 |
parents | ddc38de331ff |
children | eaf013720ec8 |
comparison
equal
deleted
inserted
replaced
25289:82de8cfb8bdc | 25290:8b7ea875afed |
---|---|
2081 CheckFeature clientserver | 2081 CheckFeature clientserver |
2082 CheckEnv DISPLAY | 2082 CheckEnv DISPLAY |
2083 CheckDefFailure(['remote_startserver({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>') | 2083 CheckDefFailure(['remote_startserver({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>') |
2084 enddef | 2084 enddef |
2085 | 2085 |
2086 def Test_remove_const_list() | |
2087 var l: list<number> = [1, 2, 3, 4] | |
2088 assert_equal([1, 2], remove(l, 0, 1)) | |
2089 assert_equal([3, 4], l) | |
2090 enddef | |
2091 | |
2086 def Test_remove_return_type() | 2092 def Test_remove_return_type() |
2087 var l = remove({one: [1, 2], two: [3, 4]}, 'one') | 2093 var l = remove({one: [1, 2], two: [3, 4]}, 'one') |
2088 var res = 0 | 2094 var res = 0 |
2089 for n in l | 2095 for n in l |
2090 res += n | 2096 res += n |