MCPcopy
hub / github.com/pquerna/ffjson / TestHTMLEscape

Function TestHTMLEscape

tests/encode_test.go:259–267  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

257}
258
259func 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}

Callers

nothing calls this directly

Calls 2

WriteMethod · 0.95
BytesMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…