v2 / vlib / v / tests / nested_map_index_test.v
24 lines · 22 sloc · 253 bytes · 612faac0f05824d56c466e1620d4e70d3a5f2168
Raw
1struct Foo {
2mut:
3 foo map[int]Bar
4}
5
6struct Bar {
7mut:
8 bar map[int]string
9}
10
11fn test_nested_map_index() {
12 f := Foo{
13 foo: {
14 11: Bar{
15 bar: {
16 22: 'hello'
17 }
18 }
19 }
20 }
21 ret := f.foo[11]!.bar[22]!
22 println(ret)
23 assert ret == 'hello'
24}
25