From a025e1caac516c967486f4644fbe4c647100b632 Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Wed, 18 Dec 2013 10:20:25 -0800 Subject: [PATCH] html: add tests for UnescapeString edge cases R=golang-dev, gobot, bradfitz CC=golang-dev https://golang.org/cl/40810044 --- src/pkg/html/escape_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pkg/html/escape_test.go b/src/pkg/html/escape_test.go index b405d4b4a7..2d7ad8ac26 100644 --- a/src/pkg/html/escape_test.go +++ b/src/pkg/html/escape_test.go @@ -64,6 +64,24 @@ var unescapeTests = []unescapeTest{ "Footnote‡", "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) {