summaryrefslogtreecommitdiff
path: root/libgo/go/html/parse_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/html/parse_test.go')
-rw-r--r--libgo/go/html/parse_test.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/libgo/go/html/parse_test.go b/libgo/go/html/parse_test.go
index 015b5838f0b..c929c257727 100644
--- a/libgo/go/html/parse_test.go
+++ b/libgo/go/html/parse_test.go
@@ -103,10 +103,21 @@ func dumpLevel(w io.Writer, n *Node, level int) error {
} else {
fmt.Fprintf(w, "<%s>", n.Data)
}
- for _, a := range n.Attr {
+ attr := n.Attr
+ if len(attr) == 2 && attr[0].Namespace == "xml" && attr[1].Namespace == "xlink" {
+ // Some of the test cases in tests10.dat change the order of adjusted
+ // foreign attributes, but that behavior is not in the spec, and could
+ // simply be an implementation detail of html5lib's python map ordering.
+ attr[0], attr[1] = attr[1], attr[0]
+ }
+ for _, a := range attr {
io.WriteString(w, "\n")
dumpIndent(w, level+1)
- fmt.Fprintf(w, `%s="%s"`, a.Key, a.Val)
+ if a.Namespace != "" {
+ fmt.Fprintf(w, `%s %s="%s"`, a.Namespace, a.Key, a.Val)
+ } else {
+ fmt.Fprintf(w, `%s="%s"`, a.Key, a.Val)
+ }
}
case TextNode:
fmt.Fprintf(w, `"%s"`, n.Data)
@@ -172,8 +183,8 @@ func TestParser(t *testing.T) {
{"tests3.dat", -1},
{"tests4.dat", -1},
{"tests5.dat", -1},
- {"tests6.dat", 47},
- {"tests10.dat", 16},
+ {"tests6.dat", -1},
+ {"tests10.dat", 33},
}
for _, tf := range testFiles {
f, err := os.Open("testdata/webkit/" + tf.filename)