github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/reflect2/test/map_elem_map_test.go (about) 1 package test 2 3 import ( 4 "testing" 5 "github.com/v2pro/plz/reflect2" 6 ) 7 8 func Test_map_elem_map(t *testing.T) { 9 var pInt = func(val int) *int { 10 return &val 11 } 12 var pMap = func(val map[int]int) *map[int]int { 13 return &val 14 } 15 t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { 16 obj := map[int]map[int]int{} 17 valType := api.TypeOf(obj).(reflect2.MapType) 18 valType.SetIndex(&obj, pInt(2), pMap(map[int]int{4:4})) 19 valType.SetIndex(&obj, pInt(3), pMap(map[int]int{9:9})) 20 valType.SetIndex(&obj, pInt(3), pMap(nil)) 21 return obj 22 })) 23 }