aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode_test.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2020-09-14 21:00:52 +0000
committerDamien Neil <dneil@google.com>2020-09-14 21:33:20 +0000
commit114719e16e9681bd1001326598ededa719c17944 (patch)
tree0773ea1d3d97233585db743c95c5f76247d60969 /src/encoding/json/decode_test.go
parenta408139bb0166f6e0a5d9fd17fc934da960c354e (diff)
downloadgo-114719e16e9681bd1001326598ededa719c17944.tar.xz
Revert "encoding/json: implement Is on all errors"
This reverts CL 254537. Reason for revert: Reason for revert: The recommended way to check for a type of error is errors.As. API changes should also start with a proposal. Change-Id: I07c37428575e99c80b17525833a61831d10963bb Reviewed-on: https://go-review.googlesource.com/c/go/+/254857 Trust: Damien Neil <dneil@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Diffstat (limited to 'src/encoding/json/decode_test.go')
-rw-r--r--src/encoding/json/decode_test.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go
index b707dcfa99..219e845c7b 100644
--- a/src/encoding/json/decode_test.go
+++ b/src/encoding/json/decode_test.go
@@ -2572,34 +2572,3 @@ func TestUnmarshalMaxDepth(t *testing.T) {
}
}
}
-
-func TestInvalidUnmarshalErrorIs(t *testing.T) {
- err := fmt.Errorf("apackage: %w: failed to parse struct", &InvalidUnmarshalError{reflect.TypeOf("a")})
- if !errors.Is(err, &InvalidUnmarshalError{}) {
- t.Fatalf("%v should be unwrapped to a InvalidUnmarshalError", err)
- }
-}
-
-func TestUnmarshalFieldErrorIs(t *testing.T) {
- err := fmt.Errorf("apackage: %w: failed to parse struct", &UnmarshalFieldError{
- Key: "foo",
- Type: reflect.TypeOf("a"),
- Field: reflect.StructField{Name: "b"},
- })
- if !errors.Is(err, &UnmarshalFieldError{}) {
- t.Fatalf("%v should be unwrapped to a UnmarshalFieldError", err)
- }
-}
-
-func TestUnmarshalTypeErrorIs(t *testing.T) {
- err := fmt.Errorf("apackage: %w: failed to parse struct", &UnmarshalTypeError{
- Value: "foo",
- Type: reflect.TypeOf("a"),
- Offset: 1,
- Struct: "Foo",
- Field: "Bar",
- })
- if !errors.Is(err, &UnmarshalTypeError{}) {
- t.Fatalf("%v should be unwrapped to a UnmarshalTypeError", err)
- }
-}