annotation-go/registry_test.go

93 lines
1.9 KiB
Go
Raw Normal View History

2018-07-17 10:58:14 +00:00
package annotation
import (
"reflect"
"testing"
)
func TestAnnotationRegistry_Register(t *testing.T) {
type fields struct {
parent Registry
definitions map[string]*Definition
}
type args struct {
t reflect.Type
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
r := &AnnotationRegistry{
parent: tt.fields.parent,
definitions: tt.fields.definitions,
}
if err := r.Register(tt.args.t); (err != nil) != tt.wantErr {
t.Errorf("AnnotationRegistry.Register() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestAnnotationRegistry_Get(t *testing.T) {
type fields struct {
parent Registry
definitions map[string]*Definition
}
type args struct {
f *reflect.StructField
}
tests := []struct {
name string
fields fields
args args
want map[reflect.Type]Annotation
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
r := &AnnotationRegistry{
parent: tt.fields.parent,
definitions: tt.fields.definitions,
}
got, err := r.Get(tt.args.f)
if (err != nil) != tt.wantErr {
t.Errorf("AnnotationRegistry.Get() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("AnnotationRegistry.Get() = %v, want %v", got, tt.want)
}
})
}
}
func Test_findAnnotatedFields(t *testing.T) {
type args struct {
t reflect.Type
ft reflect.Type
deep bool
}
tests := []struct {
name string
args args
want map[string]*reflect.StructField
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := findAnnotatedFields(tt.args.t, tt.args.ft, tt.args.deep); !reflect.DeepEqual(got, tt.want) {
t.Errorf("findAnnotatedFields() = %v, want %v", got, tt.want)
}
})
}
}