From 2f39a33b6a34cbc71ded902053cbd10447b073dc Mon Sep 17 00:00:00 2001 From: Andrew Balholm Date: Fri, 3 Aug 2012 09:31:45 +1000 Subject: [PATCH] exp/html: in parse tests, discard only one trailing newline Pass 2 additional tests. R=nigeltao CC=golang-dev https://golang.org/cl/6454090 --- src/pkg/exp/html/parse_test.go | 5 ++++- src/pkg/exp/html/testlogs/tests16.dat.log | 2 +- src/pkg/exp/html/testlogs/tests26.dat.log | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pkg/exp/html/parse_test.go b/src/pkg/exp/html/parse_test.go index 2e8dfbf107..e3c69b6f5b 100644 --- a/src/pkg/exp/html/parse_test.go +++ b/src/pkg/exp/html/parse_test.go @@ -45,7 +45,10 @@ func readParseTest(r *bufio.Reader) (text, want, context string, err error) { } b = append(b, line...) } - text = strings.TrimRight(string(b), "\n") + text = string(b) + if strings.HasSuffix(text, "\n") { + text = text[:len(text)-1] + } b = b[:0] // Skip the error list. diff --git a/src/pkg/exp/html/testlogs/tests16.dat.log b/src/pkg/exp/html/testlogs/tests16.dat.log index 4f1e211962..23e2789eea 100644 --- a/src/pkg/exp/html/testlogs/tests16.dat.log +++ b/src/pkg/exp/html/testlogs/tests16.dat.log @@ -186,6 +186,6 @@ PASS "-->" PASS "" PASS "<!--<xmp>-->" PASS "<!--<noembed>-->" -FAIL "" +PASS "
\n" PASS "
" PARSE "
" diff --git a/src/pkg/exp/html/testlogs/tests26.dat.log b/src/pkg/exp/html/testlogs/tests26.dat.log index 17c6ae82cb..fa97b44cd1 100644 --- a/src/pkg/exp/html/testlogs/tests26.dat.log +++ b/src/pkg/exp/html/testlogs/tests26.dat.log @@ -7,7 +7,7 @@ PASS "1
23" PASS "1" PASS "12" PASS "12" -FAIL "

" +PASS "

\n" PASS "

a" PASS "

a" PASS "

a" -- 2.48.1