| 1 | fn foo(mut m map[string][1][2]map[string]int) { |
| 2 | m['foo'] = [[{ |
| 3 | 'bar': 1 |
| 4 | }, { |
| 5 | 'baz': 3 |
| 6 | }]!]! |
| 7 | } |
| 8 | |
| 9 | fn test_complex_map_fixed_array() { |
| 10 | mut m := map[string][1][2]map[string]int{} |
| 11 | foo(mut m) |
| 12 | println(m) |
| 13 | assert '${m}' == "{'foo': [[{'bar': 1}, {'baz': 3}]]}" |
| 14 | } |
| 15 | |
| 16 | fn test_innermost_value_of_map_fixed_array() { |
| 17 | mut m := map[string][1][2]map[string]int{} |
| 18 | m['foo'] = [[{ |
| 19 | 'bar': 1 |
| 20 | }, { |
| 21 | 'baz': 3 |
| 22 | }]!]! |
| 23 | println(m['foo'][0][0]['bar']) |
| 24 | println(m['foo'][0][0]['bar'] == 1) |
| 25 | assert m['foo'][0][0]['bar'] == 1 |
| 26 | assert '${m['foo'][0][0]['bar']}' == '1' |
| 27 | } |
| 28 | |
| 29 | fn test_complex_map_high_order_fixed_array() { |
| 30 | mut m := { |
| 31 | 'foo': [[{ |
| 32 | 'a': 1 |
| 33 | }]!]! |
| 34 | 'bar': [[{ |
| 35 | 'b': 2 |
| 36 | }]!]! |
| 37 | } |
| 38 | for _, mut j in m { |
| 39 | j = [[{ |
| 40 | 'c': 3 |
| 41 | }]!]! |
| 42 | } |
| 43 | println(m) |
| 44 | assert '${m}' == "{'foo': [[{'c': 3}]], 'bar': [[{'c': 3}]]}" |
| 45 | } |
| 46 | |