Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 72f7bad

Browse files
author
Markus Ritberger
committed
check for ptr error type in tests
1 parent 9bc94d8 commit 72f7bad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

request_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_bool(t *testing.T) {
136136
if err.Error() != expectedErrorMessage {
137137
t.Fatalf("Unexpected error message: %s", err.Error())
138138
}
139+
if _, ok := err.(ErrUnsupportedPtrType); !ok {
140+
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
141+
}
139142
}
140143

141144
func TestUnmarshalToStructWithPointerAttr_BadType_MapPtr(t *testing.T) {
@@ -153,6 +156,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_MapPtr(t *testing.T) {
153156
if err.Error() != expectedErrorMessage {
154157
t.Fatalf("Unexpected error message: %s", err.Error())
155158
}
159+
if _, ok := err.(ErrUnsupportedPtrType); !ok {
160+
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
161+
}
156162
}
157163

158164
func TestUnmarshalToStructWithPointerAttr_BadType_Struct(t *testing.T) {
@@ -171,6 +177,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_Struct(t *testing.T) {
171177
if err.Error() != expectedErrorMessage {
172178
t.Fatalf("Unexpected error message: %s", err.Error())
173179
}
180+
if _, ok := err.(ErrUnsupportedPtrType); !ok {
181+
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
182+
}
174183
}
175184

176185
func TestUnmarshalToStructWithPointerAttr_BadType_IntSlice(t *testing.T) {
@@ -189,6 +198,9 @@ func TestUnmarshalToStructWithPointerAttr_BadType_IntSlice(t *testing.T) {
189198
if err.Error() != expectedErrorMessage {
190199
t.Fatalf("Unexpected error message: %s", err.Error())
191200
}
201+
if _, ok := err.(ErrUnsupportedPtrType); !ok {
202+
t.Fatalf("Unexpected error type: %s", reflect.TypeOf(err))
203+
}
192204
}
193205

194206
func TestStringPointerField(t *testing.T) {

0 commit comments

Comments
 (0)