diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index 652bf805de9..beba98d3ad2 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -69,11 +69,15 @@ func readDat(filename string, c chan io.Reader) { } } -func dumpLevel(w io.Writer, n *Node, level int) os.Error { +func dumpIndent(w io.Writer, level int) { io.WriteString(w, "| ") for i := 0; i < level; i++ { io.WriteString(w, " ") } +} + +func dumpLevel(w io.Writer, n *Node, level int) os.Error { + dumpIndent(w, level) switch n.Type { case ErrorNode: return os.NewError("unexpected ErrorNode") @@ -81,6 +85,11 @@ func dumpLevel(w io.Writer, n *Node, level int) os.Error { return os.NewError("unexpected DocumentNode") case ElementNode: fmt.Fprintf(w, "<%s>", n.Data) + for _, a := range n.Attr { + io.WriteString(w, "\n") + dumpIndent(w, level+1) + fmt.Fprintf(w, `%s="%s"`, a.Key, a.Val) + } case TextNode: fmt.Fprintf(w, "%q", n.Data) case CommentNode: @@ -123,7 +132,7 @@ 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 < 31; i++ { + for i := 0; i < 32; i++ { // Parse the #data section. b, err := ioutil.ReadAll(<-rc) if err != nil {