summaryrefslogtreecommitdiff
path: root/libgo/go/encoding/json/stream_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-01-02 15:05:27 -0800
committerIan Lance Taylor <iant@golang.org>2020-01-21 23:53:22 -0800
commit5a8ea165926cb0737ab03bc48c18dc5198ab5305 (patch)
tree962dc3357c57f019f85658f99e2e753e30201c27 /libgo/go/encoding/json/stream_test.go
parent6ac6529e155c9baa0aaaed7aca06bd38ebda5b43 (diff)
libgo: update to Go1.14beta1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/214297
Diffstat (limited to 'libgo/go/encoding/json/stream_test.go')
-rw-r--r--libgo/go/encoding/json/stream_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libgo/go/encoding/json/stream_test.go b/libgo/go/encoding/json/stream_test.go
index e3317ddeb0b..ebb4f231d15 100644
--- a/libgo/go/encoding/json/stream_test.go
+++ b/libgo/go/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)