summaryrefslogtreecommitdiff
path: root/libgo/go/html/template/html_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/html/template/html_test.go')
-rw-r--r--libgo/go/html/template/html_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/libgo/go/html/template/html_test.go b/libgo/go/html/template/html_test.go
index b9b97038757..f04ee04c27a 100644
--- a/libgo/go/html/template/html_test.go
+++ b/libgo/go/html/template/html_test.go
@@ -19,7 +19,8 @@ func TestHTMLNospaceEscaper(t *testing.T) {
`PQRSTUVWXYZ[\]^_` +
"`abcdefghijklmno" +
"pqrstuvwxyz{|}~\x7f" +
- "\u00A0\u0100\u2028\u2029\ufeff\ufdec\U0001D11E")
+ "\u00A0\u0100\u2028\u2029\ufeff\ufdec\U0001D11E" +
+ "erroneous\x960") // keep at the end
want := ("�\x01\x02\x03\x04\x05\x06\x07" +
"\x08	

\x0E\x0F" +
@@ -31,14 +32,16 @@ func TestHTMLNospaceEscaper(t *testing.T) {
`PQRSTUVWXYZ[\]^_` +
``abcdefghijklmno` +
`pqrstuvwxyz{|}~` + "\u007f" +
- "\u00A0\u0100\u2028\u2029\ufeff\U0001D11E")
+ "\u00A0\u0100\u2028\u2029\ufeff\U0001D11E" +
+ "erroneous�0") // keep at the end
got := htmlNospaceEscaper(input)
if got != want {
t.Errorf("encode: want\n\t%q\nbut got\n\t%q", want, got)
}
- got, want = html.UnescapeString(got), strings.Replace(input, "\x00", "\ufffd", 1)
+ r := strings.NewReplacer("\x00", "\ufffd", "\x96", "\ufffd")
+ got, want = html.UnescapeString(got), r.Replace(input)
if want != got {
t.Errorf("decode: want\n\t%q\nbut got\n\t%q", want, got)
}