github.com/fengyoulin/inspect@v0.2.1/eface_test.go (about)

     1  package inspect_test
     2  
     3  import (
     4  	"github.com/fengyoulin/inspect"
     5  	"reflect"
     6  	"testing"
     7  	"unsafe"
     8  )
     9  
    10  func TestPackEFace(t *testing.T) {
    11  	n := int64(123)
    12  	p := unsafe.Pointer(&n)
    13  	e := inspect.PackEFace(reflect.TypeOf(int64(0)), p)
    14  	if v, ok := e.(int64); !ok || v != n {
    15  		t.Error(ok, v)
    16  	}
    17  }