vim-patch:partial:9.0.0327: items() does not work on a list

Problem:    items() does not work on a list. (Sergey Vlasov)
Solution:   Make items() work on a list. (closes vim/vim#11013)

976f859763

Skip CHECK_LIST_MATERIALIZE.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2024-07-30 11:08:16 +08:00
parent cd46383667
commit 96b358e9f1
3 changed files with 73 additions and 20 deletions

View File

@@ -195,6 +195,17 @@ func Test_list_range_assign()
call CheckDefAndScriptFailure(lines, 'E1012:', 2)
endfunc
func Test_list_items()
let r = []
let l = ['a', 'b', 'c']
for [idx, val] in items(l)
call extend(r, [[idx, val]])
endfor
call assert_equal([[0, 'a'], [1, 'b'], [2, 'c']], r)
call assert_fails('call items(3)', 'E1227:')
endfunc
" Test removing items in list
func Test_list_func_remove()
let lines =<< trim END