github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/reflect2/test15/map_test.go (about)

     1  package test
     2  
     3  import (
     4  	"testing"
     5  	"github.com/v2pro/plz/reflect2"
     6  )
     7  
     8  func Test_map(t *testing.T) {
     9  	var pInt = func(val int) *int {
    10  		return &val
    11  	}
    12  	valType := reflect2.TypeOf(map[int]int{}).(reflect2.MapType)
    13  	m := map[int]int{}
    14  	valType.SetIndex(&m, pInt(1), pInt(1))
    15  	if m[1] != 1 {
    16  		t.Fail()
    17  	}
    18  }