aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/html/parse_test.go
diff options
context:
space:
mode:
authorNigel Tao <nigeltao@golang.org>2010-12-15 11:39:56 +1100
committerNigel Tao <nigeltao@golang.org>2010-12-15 11:39:56 +1100
commitfec6ab97262c45797af9b645f28e64c1217a593a (patch)
treeaf1fd6ed64b416ef27114d618e8a905f63761440 /src/pkg/html/parse_test.go
parent8132bb1c7458431a5324364d63a7e46ec01fa499 (diff)
downloadgo-fec6ab97262c45797af9b645f28e64c1217a593a.tar.xz
html: parse "<h1>foo<h2>bar".
R=gri CC=golang-dev https://golang.org/cl/3571043
Diffstat (limited to 'src/pkg/html/parse_test.go')
-rw-r--r--src/pkg/html/parse_test.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go
index dbfc57f666..d153533b58 100644
--- a/src/pkg/html/parse_test.go
+++ b/src/pkg/html/parse_test.go
@@ -11,6 +11,7 @@ import (
"io"
"io/ioutil"
"os"
+ "strings"
"testing"
)
@@ -124,9 +125,14 @@ func TestParser(t *testing.T) {
rc := make(chan io.Reader)
go readDat(filename, rc)
// TODO(nigeltao): Process all test cases, not just a subset.
- for i := 0; i < 21; i++ {
+ for i := 0; i < 22; i++ {
// Parse the #data section.
- doc, err := Parse(<-rc)
+ b, err := ioutil.ReadAll(<-rc)
+ if err != nil {
+ t.Fatal(err)
+ }
+ text := string(b)
+ doc, err := Parse(strings.NewReader(text))
if err != nil {
t.Fatal(err)
}
@@ -139,13 +145,13 @@ func TestParser(t *testing.T) {
t.Fatal(err)
}
// Compare the parsed tree to the #document section.
- b, err := ioutil.ReadAll(<-rc)
+ b, err = ioutil.ReadAll(<-rc)
if err != nil {
t.Fatal(err)
}
expected := string(b)
if actual != expected {
- t.Errorf("%s test #%d, actual vs expected:\n----\n%s----\n%s----", filename, i, actual, expected)
+ t.Errorf("%s test #%d %q, actual vs expected:\n----\n%s----\n%s----", filename, i, text, actual, expected)
}
}
}