X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=libgo%2Fgo%2Fhtml%2Fparse_test.go;h=c929c257727f2e27fbdef26bd2645d18b3b7083a;hp=015b5838f0b50b3a0e8f33e39c545dc68988a60c;hb=422eaae5fe0038ad189b8fd28cfd6a7094d67ae1;hpb=e0f3ea3ed4b9d0bce9f4c14762e4257ba62c8fba 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)