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

v.gen.c: fix assigning a fixed array variable to a map value (#10523)

This commit is contained in:
yuyi
2021-06-20 13:09:24 +08:00
committed by GitHub
parent 79879128b6
commit afc81277be
2 changed files with 29 additions and 10 deletions

View File

@@ -932,3 +932,16 @@ fn test_u64_keys() {
}
assert m.len == 0
}
fn test_map_set_fixed_array_variable() {
mut m := map[string][2]f64{}
m['A'] = [1.1, 2.2]!
println(m)
assert '$m' == "{'A': [1.1, 2.2]}"
mut m2 := map[string][2]f64{}
arr := [1.1, 2.2]!
m2['A'] = arr
println(m2)
assert '$m2' == "{'A': [1.1, 2.2]}"
}