github.com/ovechkin-dm/go-dyno@v0.0.23/proxy/proxy_test.go (about)

     1  package proxy
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  )
     7  
     8  type MyInterface interface {
     9  	Foo(a int) int
    10  }
    11  
    12  func TestCreate(t *testing.T) {
    13  	v, err := Create[MyInterface](func(m *MethodInfo, values []reflect.Value) []reflect.Value {
    14  		return []reflect.Value{reflect.ValueOf(10)}
    15  	})
    16  	if err != nil {
    17  		t.Error(err)
    18  	}
    19  	r := v.Foo(20)
    20  	if r != 10 {
    21  		t.FailNow()
    22  	}
    23  }