]> Cypherpunks repositories - gostls13.git/commitdiff
html: add tests for UnescapeString edge cases
authorShawn Smith <shawn.p.smith@gmail.com>
Wed, 18 Dec 2013 18:20:25 +0000 (10:20 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 18 Dec 2013 18:20:25 +0000 (10:20 -0800)
R=golang-dev, gobot, bradfitz
CC=golang-dev
https://golang.org/cl/40810044

src/pkg/html/escape_test.go

index b405d4b4a778cc65f29d0a679a91352d618ee360..2d7ad8ac266c22968578d2ef211abb9500805b8a 100644 (file)
@@ -64,6 +64,24 @@ var unescapeTests = []unescapeTest{
                "Footnote&#x87;",
                "Footnote‡",
        },
+       // Handle single ampersand.
+       {
+               "copySingleAmpersand",
+               "&",
+               "&",
+       },
+       // Handle ampersand followed by non-entity.
+       {
+               "copyAmpersandNonEntity",
+               "text &test",
+               "text &test",
+       },
+       // Handle "&#".
+       {
+               "copyAmpersandHash",
+               "text &#",
+               "text &#",
+       },
 }
 
 func TestUnescape(t *testing.T) {