check for ptr error type in tests

This commit is contained in:
Markus Ritberger 2018-03-14 21:43:24 +01:00
parent 9bc94d8c70
commit 72f7bad5b3
1 changed files with 12 additions and 0 deletions

View File

@ -136,6 +136,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_bool(t *testing.T) {
if err.Error() != expectedErrorMessage {
t.Fatalf("Unexpected error message: %s", err.Error())
}
if _, ok := err.(ErrUnsupportedPtrType); !ok {
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
}
}
func TestUnmarshalToStructWithPointerAttr_BadType_MapPtr(t *testing.T) {
@ -153,6 +156,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_MapPtr(t *testing.T) {
if err.Error() != expectedErrorMessage {
t.Fatalf("Unexpected error message: %s", err.Error())
}
if _, ok := err.(ErrUnsupportedPtrType); !ok {
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
}
}
func TestUnmarshalToStructWithPointerAttr_BadType_Struct(t *testing.T) {
@ -171,6 +177,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_Struct(t *testing.T) {
if err.Error() != expectedErrorMessage {
t.Fatalf("Unexpected error message: %s", err.Error())
}
if _, ok := err.(ErrUnsupportedPtrType); !ok {
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
}
}
func TestUnmarshalToStructWithPointerAttr_BadType_IntSlice(t *testing.T) {
@ -189,6 +198,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_IntSlice(t *testing.T) {
if err.Error() != expectedErrorMessage {
t.Fatalf("Unexpected error message: %s", err.Error())
}
if _, ok := err.(ErrUnsupportedPtrType); !ok {
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
}
}
func TestStringPointerField(t *testing.T) {