aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/stream_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/stream_test.go')
-rw-r--r--src/encoding/json/stream_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/encoding/json/stream_test.go b/src/encoding/json/stream_test.go
index e3317ddeb0..ebb4f231d1 100644
--- a/src/encoding/json/stream_test.go
+++ b/src/encoding/json/stream_test.go
@@ -118,6 +118,11 @@ func TestEncoderSetEscapeHTML(t *testing.T) {
Ptr strPtrMarshaler
}{`"<str>"`, `"<str>"`}
+ // https://golang.org/issue/34154
+ stringOption := struct {
+ Bar string `json:"bar,string"`
+ }{`<html>foobar</html>`}
+
for _, tt := range []struct {
name string
v interface{}
@@ -137,6 +142,11 @@ func TestEncoderSetEscapeHTML(t *testing.T) {
`{"NonPtr":"\u003cstr\u003e","Ptr":"\u003cstr\u003e"}`,
`{"NonPtr":"<str>","Ptr":"<str>"}`,
},
+ {
+ "stringOption", stringOption,
+ `{"bar":"\"\u003chtml\u003efoobar\u003c/html\u003e\""}`,
+ `{"bar":"\"<html>foobar</html>\""}`,
+ },
} {
var buf bytes.Buffer
enc := NewEncoder(&buf)