aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode_test.go
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2019-08-20 17:29:04 -0400
committerAndrew Bonventre <andybons@golang.org>2019-08-21 15:20:00 +0000
commiteee07a8e685e72c287ca4a0e7a049ce941ef6ab3 (patch)
treea5f419187df6ee5691e8386e2f777077219064ed /src/encoding/json/decode_test.go
parentc61c29fe563134f752ea14e794d08031982145e8 (diff)
downloadgo-eee07a8e685e72c287ca4a0e7a049ce941ef6ab3.tar.xz
Revert "encoding/json: avoid work when unquoting strings"
This reverts CL 151157. CL 151157 introduced a crash when decoding into ",string" fields. It came with a moderate speedup, so at this stage of the release cycle let's just revert it, and reapply it in Go 1.14 with the fix in CL 190659. Also applied the test cases from CL 190659. Updates #33728 Change-Id: Ie46e2bc15224b251888580daf6b79d5865f3878e Reviewed-on: https://go-review.googlesource.com/c/go/+/190909 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
Diffstat (limited to 'src/encoding/json/decode_test.go')
-rw-r--r--src/encoding/json/decode_test.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go
index 719a9fa290..3f25893b41 100644
--- a/src/encoding/json/decode_test.go
+++ b/src/encoding/json/decode_test.go
@@ -1250,6 +1250,8 @@ var wrongStringTests = []wrongStringTest{
{`{"result":"foo"}`, `json: invalid use of ,string struct tag, trying to unmarshal "foo" into string`},
{`{"result":"123"}`, `json: invalid use of ,string struct tag, trying to unmarshal "123" into string`},
{`{"result":123}`, `json: invalid use of ,string struct tag, trying to unmarshal unquoted value into string`},
+ {`{"result":"\""}`, `json: invalid use of ,string struct tag, trying to unmarshal "\"" into string`},
+ {`{"result":"\"foo"}`, `json: invalid use of ,string struct tag, trying to unmarshal "\"foo" into string`},
}
// If people misuse the ,string modifier, the error message should be