diff options
Diffstat (limited to 'src/encoding/json/encode_test.go')
| -rw-r--r-- | src/encoding/json/encode_test.go | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/encoding/json/encode_test.go b/src/encoding/json/encode_test.go index 90826a7f47..7290eca06f 100644 --- a/src/encoding/json/encode_test.go +++ b/src/encoding/json/encode_test.go @@ -7,7 +7,6 @@ package json import ( "bytes" "encoding" - "errors" "fmt" "log" "math" @@ -212,7 +211,7 @@ var unsupportedValues = []interface{}{ func TestUnsupportedValues(t *testing.T) { for _, v := range unsupportedValues { if _, err := Marshal(v); err != nil { - if !errors.Is(err, &UnsupportedValueError{}) { + if _, ok := err.(*UnsupportedValueError); !ok { t.Errorf("for %v, got %T want UnsupportedValueError", v, err) } } else { @@ -1156,24 +1155,3 @@ func TestMarshalerError(t *testing.T) { } } } - -func TestMarshalerErrorIs(t *testing.T) { - err := fmt.Errorf("apackage: %w: failed to parse struct", &MarshalerError{ - reflect.TypeOf("a"), - fmt.Errorf("something"), - "TestMarshalerErrorIs", - }) - if !errors.Is(err, &MarshalerError{}) { - t.Fatalf("%v should be unwrapped to a MarshalerError", err) - } -} - -func TestUnsupportedValueErrorIs(t *testing.T) { - err := fmt.Errorf("apackage: %w: failed to parse struct", &UnsupportedValueError{ - Value: reflect.Value{}, - Str: "Foo", - }) - if !errors.Is(err, &UnsupportedValueError{}) { - t.Fatalf("%v should be unwrapped to a UnsupportedValueError", err) - } -} |
