mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
parent
e03a50dd11
commit
b5b6ce0804
2 changed files with 47 additions and 0 deletions
|
|
@ -139,6 +139,16 @@ func TestUnmarshalPtrPtr(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHTMLEscape(t *testing.T) {
|
||||
b, err := MarshalForHTML("foobarbaz<>&quux")
|
||||
if err != nil {
|
||||
t.Fatalf("MarshalForHTML error: %v", err)
|
||||
}
|
||||
if !bytes.Equal(b, []byte(`"foobarbaz\u003c\u003e\u0026quux"`)) {
|
||||
t.Fatalf("Unexpected encoding of \"<>&\": %s", b)
|
||||
}
|
||||
}
|
||||
|
||||
func noSpace(c int) int {
|
||||
if isSpace(c) {
|
||||
return -1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue