(t *testing.T)
| 257 | } |
| 258 | |
| 259 | func TestHTMLEscape(t *testing.T) { |
| 260 | var b, want bytes.Buffer |
| 261 | m := `{"M":"<html>foo &` + "\xe2\x80\xa8 \xe2\x80\xa9" + `</html>"}` |
| 262 | want.Write([]byte(`{"M":"\u003chtml\u003efoo \u0026\u2028 \u2029\u003c/html\u003e"}`)) |
| 263 | json.HTMLEscape(&b, []byte(m)) |
| 264 | if !bytes.Equal(b.Bytes(), want.Bytes()) { |
| 265 | t.Errorf("HTMLEscape(&b, []byte(m)) = %s; want %s", b.Bytes(), want.Bytes()) |
| 266 | } |
| 267 | } |