exp/html: in parse tests, discard only one trailing newline

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454090
This commit is contained in:
Andrew Balholm 2012-08-03 09:31:45 +10:00 committed by Nigel Tao
parent 1916db786f
commit 2f39a33b6a
3 changed files with 6 additions and 3 deletions

View File

@ -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.

View File

@ -186,6 +186,6 @@ PASS "<iframe><!--<iframe></iframe>--></iframe>"
PASS "<iframe>...<!--X->...<!--/X->...</iframe>"
PASS "<xmp><!--<xmp></xmp>--></xmp>"
PASS "<noembed><!--<noembed></noembed>--></noembed>"
FAIL "<!doctype html><table>"
PASS "<!doctype html><table>\n"
PASS "<!doctype html><table><td><span><font></span><span>"
PARSE "<!doctype html><form><table></form><form></table></form>"

View File

@ -7,7 +7,7 @@ PASS "<!DOCTYPE html><body><b><nobr>1<nobr></b><div><i><nobr>2<nobr></i>3"
PASS "<!DOCTYPE html><body><b><nobr>1<nobr><ins></b><i><nobr>"
PASS "<!DOCTYPE html><body><b><nobr>1<ins><nobr></b><i>2"
PASS "<!DOCTYPE html><body><b>1<nobr></b><i><nobr>2</i>"
FAIL "<p><code x</code></p>"
PASS "<p><code x</code></p>\n"
PASS "<!DOCTYPE html><svg><foreignObject><p><i></p>a"
PASS "<!DOCTYPE html><table><tr><td><svg><foreignObject><p><i></p>a"
PASS "<!DOCTYPE html><math><mtext><p><i></p>a"