| 123456789101112131415161718 |
- package test
- import (
- "testing"
- "github.com/modern-go/reflect2"
- )
- func Test_map(t *testing.T) {
- var pInt = func(val int) *int {
- return &val
- }
- valType := reflect2.TypeOf(map[int]int{}).(reflect2.MapType)
- m := map[int]int{}
- valType.SetIndex(&m, pInt(1), pInt(1))
- if m[1] != 1 {
- t.Fail()
- }
- }
|