| 1 | struct Instr { |
| 2 | mut: |
| 3 | a int |
| 4 | b int |
| 5 | } |
| 6 | |
| 7 | fn test_map_complex_array() { |
| 8 | mut map1 := map[string][]&Instr{} |
| 9 | instr := &Instr{ |
| 10 | a: 1 |
| 11 | b: 2 |
| 12 | } |
| 13 | arr := [instr] |
| 14 | map1['Hello'] = arr |
| 15 | unsafe { |
| 16 | map1['Hello'][0].a = 2 |
| 17 | println(map1['Hello'][0].a) |
| 18 | assert map1['Hello'][0].a == 2 |
| 19 | assert map1['Hello'][0].b == 2 |
| 20 | } |
| 21 | } |
| 22 |