From: Andrew Balholm Date: Thu, 2 Aug 2012 23:31:45 +0000 (+1000) Subject: exp/html: in parse tests, discard only one trailing newline X-Git-Tag: go1.1rc2~2720 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2f39a33b6a34cbc71ded902053cbd10447b073dc;p=gostls13.git exp/html: in parse tests, discard only one trailing newline Pass 2 additional tests. R=nigeltao CC=golang-dev https://golang.org/cl/6454090 --- 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"