aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/html/parse_test.go
diff options
context:
space:
mode:
authorNigel Tao <nigeltao@golang.org>2011-12-13 13:52:47 +1100
committerNigel Tao <nigeltao@golang.org>2011-12-13 13:52:47 +1100
commitb9064fb13287c49ba978715af6da797428dcb77d (patch)
treeedeba86bc96ec586433fc17b01718245f40b97b7 /src/pkg/html/parse_test.go
parent0643aacee97359ba542a4b0e4600a0d029fe1c79 (diff)
downloadgo-b9064fb13287c49ba978715af6da797428dcb77d.tar.xz
html: a first step at parsing foreign content (MathML, SVG).
Nodes now have a Namespace field. Pass adoption01.dat, test 12: <a><svg><tr><input></a> | <html> | <head> | <body> | <a> | <svg svg> | <svg tr> | <svg input> The other adoption01.dat tests already passed. R=andybalholm CC=golang-dev https://golang.org/cl/5467075
Diffstat (limited to 'src/pkg/html/parse_test.go')
-rw-r--r--src/pkg/html/parse_test.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go
index 8f8787886c..0eba283b98 100644
--- a/src/pkg/html/parse_test.go
+++ b/src/pkg/html/parse_test.go
@@ -98,7 +98,11 @@ func dumpLevel(w io.Writer, n *Node, level int) error {
case DocumentNode:
return errors.New("unexpected DocumentNode")
case ElementNode:
- fmt.Fprintf(w, "<%s>", n.Data)
+ if n.Namespace != "" {
+ fmt.Fprintf(w, "<%s %s>", n.Namespace, n.Data)
+ } else {
+ fmt.Fprintf(w, "<%s>", n.Data)
+ }
for _, a := range n.Attr {
io.WriteString(w, "\n")
dumpIndent(w, level+1)
@@ -161,6 +165,7 @@ func TestParser(t *testing.T) {
n int
}{
// TODO(nigeltao): Process all the test cases from all the .dat files.
+ {"adoption01.dat", -1},
{"doctype01.dat", -1},
{"tests1.dat", -1},
{"tests2.dat", -1},