diff options
Diffstat (limited to 'src/encoding/json/scanner_test.go')
| -rw-r--r-- | src/encoding/json/scanner_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/encoding/json/scanner_test.go b/src/encoding/json/scanner_test.go index 3737516a45..c12d9bf3d7 100644 --- a/src/encoding/json/scanner_test.go +++ b/src/encoding/json/scanner_test.go @@ -6,6 +6,8 @@ package json import ( "bytes" + "errors" + "fmt" "math" "math/rand" "reflect" @@ -201,6 +203,13 @@ func TestIndentErrors(t *testing.T) { } } +func TestSyntaxErrorIs(t *testing.T) { + err := fmt.Errorf("apackage: %w: failed to parse struct", &SyntaxError{"some error", 43}) + if !errors.Is(err, &SyntaxError{}) { + t.Fatalf("%v should be unwrapped to a SyntaxError", err) + } +} + func diff(t *testing.T, a, b []byte) { for i := 0; ; i++ { if i >= len(a) || i >= len(b) || a[i] != b[i] { |
