vim-patch:8.2.3332: Vim9: cannot assign to range in list

Problem:    Vim9: cannot assign to range in list.
Solution:   Implement overwriting a list range.

4f0884d6e2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-06-12 20:35:01 +08:00
parent 0eb02ea90a
commit aa92a04bee
3 changed files with 127 additions and 78 deletions

View File

@@ -178,11 +178,14 @@ endfunc
" test for range assign
func Test_list_range_assign()
let l = [0]
let l[:] = [1, 2]
call assert_equal([1, 2], l)
let l[-4:-1] = [5, 6]
call assert_equal([5, 6], l)
let lines =<< trim END
VAR l = [0]
LET l[:] = [1, 2]
call assert_equal([1, 2], l)
LET l[-4 : -1] = [5, 6]
call assert_equal([5, 6], l)
END
call CheckLegacyAndVim9Success(lines)
endfunc
" Test removing items in list