" Tests for the List and Dict types
scriptencoding utf-8
import './vim9.vim' as v9
func TearDown()
" Run garbage collection after every test
call test_garbagecollect_now()
endfunc
" Tests for List type
" List creation
func Test_list_create()
" Creating List directly with different types
let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
call assert_equal("[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]", string(l))
call assert_equal({'a' : 1}, l[-1])
call assert_equal(1, l[-4])
let x = 10
try
let x = l[-5]
catch
call assert_match('E684:', v:exception)
endtry
call assert_equal(10, x)
endfunc
" This was allowed in legacy Vim script
let s:list_with_spaces = [1 , 2 , 3]
" List slices
func Test_list_slice()
let l = [1, 'as''d', [1