1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

❤️ awesome and unique features for end-developers are coming...

total refactor of the hero and mvc packages, see README#Next (it's not completed yet)


Former-commit-id: b85ae99cbfe5965ba919c1e15cf4989e787982c0
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-02-29 14:18:15 +02:00
parent 027eb5d6da
commit 5fc24812bc
54 changed files with 2916 additions and 2184 deletions

39
hero/reflect_test.go Normal file
View File

@@ -0,0 +1,39 @@
package hero
import (
"reflect"
"testing"
)
type testInterface interface {
Get() string
}
var testInterfaceTyp = reflect.TypeOf((*testInterface)(nil)).Elem()
type testImplPtr struct{}
func (*testImplPtr) Get() string { return "get_ptr" }
type testImpl struct{}
func (testImpl) Get() string { return "get" }
func TestEqualTypes(t *testing.T) {
of := reflect.TypeOf
var tests = map[reflect.Type]reflect.Type{
of("string"): of("input"),
of(42): of(10),
testInterfaceTyp: testInterfaceTyp,
of(new(testImplPtr)): testInterfaceTyp,
of(new(testImpl)): testInterfaceTyp,
of(testImpl{}): testInterfaceTyp,
}
for binding, input := range tests {
if !equalTypes(binding, input) {
t.Fatalf("expected type of: %s to be equal to the binded one of: %s", input, binding)
}
}
}