aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/decode_test.go')
-rw-r--r--src/encoding/json/decode_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go
index a49181e982..689cc34c24 100644
--- a/src/encoding/json/decode_test.go
+++ b/src/encoding/json/decode_test.go
@@ -2459,4 +2459,20 @@ func TestUnmarshalRescanLiteralMangledUnquote(t *testing.T) {
if t1 != t2 {
t.Errorf("Marshal and Unmarshal roundtrip mismatch: want %q got %q", t1, t2)
}
+
+ // See golang.org/issues/39555.
+ input := map[textUnmarshalerString]string{"FOO": "", `"`: ""}
+
+ encoded, err := Marshal(input)
+ if err != nil {
+ t.Fatalf("Marshal unexpected error: %v", err)
+ }
+ var got map[textUnmarshalerString]string
+ if err := Unmarshal(encoded, &got); err != nil {
+ t.Fatalf("Unmarshal unexpected error: %v", err)
+ }
+ want := map[textUnmarshalerString]string{"foo": "", `"`: ""}
+ if !reflect.DeepEqual(want, got) {
+ t.Fatalf("Unexpected roundtrip result:\nwant: %q\ngot: %q", want, got)
+ }
}