2017-12-05 13:28:42 +00:00
|
|
|
package registry
|
|
|
|
|
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
cda "git.loafle.net/commons_go/di/annotation"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRegisterType(t *testing.T) {
|
|
|
|
RegisterType(reflect.TypeOf((*TestStruct)(nil)), &cda.ComponentAnnotation{})
|
2017-12-05 13:31:19 +00:00
|
|
|
RegisterType(reflect.TypeOf((*TestStruct)(nil)), &cda.ComponentAnnotation{
|
|
|
|
Names: []string{"test1", "test2"},
|
|
|
|
})
|
|
|
|
RegisterType(reflect.TypeOf((*TestStruct)(nil)), &cda.ComponentAnnotation{
|
|
|
|
Names: []string{"test1", "test2"},
|
|
|
|
})
|
2017-12-05 13:28:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type TestStruct struct {
|
|
|
|
Name1 string `annotation:"@Inject"`
|
|
|
|
Name2 string `annotation:"@Inject()"`
|
|
|
|
Name3 string `annotation:"@Inject(name=test)"`
|
|
|
|
}
|