1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix multi_array prepend/insert (#7381)

This commit is contained in:
yuyi
2020-12-19 14:28:15 +08:00
committed by GitHub
parent 598d18cbd9
commit e4973782b1
2 changed files with 22 additions and 2 deletions

View File

@ -1181,3 +1181,23 @@ fn test_voidptr_vbytes() {
println(bytes)
}
}
fn test_multi_array_prepend() {
mut a := [][]int{}
a.prepend([1, 2, 3])
assert a == [[1, 2, 3]]
mut b := [][]int{}
b.prepend([[1, 2, 3]])
assert b == [[1, 2, 3]]
}
fn test_multi_array_insert() {
mut a := [][]int{}
a.insert(0, [1, 2, 3])
assert a == [[1, 2, 3]]
mut b := [][]int{}
b.insert(0, [[1, 2, 3]])
assert b == [[1, 2, 3]]
}