diff --git a/src/dom/test/test-sgml-parser-basic b/src/dom/test/test-sgml-parser-basic
index f1fbb653d..358871c6e 100755
--- a/src/dom/test/test-sgml-parser-basic
+++ b/src/dom/test/test-sgml-parser-basic
@@ -44,6 +44,17 @@ element: html
element: p
#text: Hello World!'
+test_output_equals \
+'Parse elements.' \
+'>a>' \
+'
+element: root
+ element: child
+ attribute: attr -> value
+ element: child2
+ element: child3
+ #text: a'
+
test_output_equals \
'Parse an enclosed comment.' \
'' \
@@ -68,26 +79,45 @@ element: root
attribute: name -> value with &foo; &...*...&...copy;...&;...' \
+'Parse attributes with garbage.' \
+"" \
'
element: root
- entity-reference: amp
- #text: ...
- entity-reference: #42
- #text: ...
- entity-reference: ...copy
- #text: ...
- #text: &;
- #text: ...
- entity-reference: #'
+ attribute: a -> b
+ attribute: c -> d
+ attribute: g -> h
+ attribute: i -> j
+ attribute: k -> '
+
+test_output_equals \
+'Parse entity references.' \
+'&-*' \
+'
+entity-reference: amp
+#text: -
+entity-reference: #42'
+
+# Just how these should be gracefully handled is not clear to me.
+test_output_equals \
+'Parse badly formatted entity references.' \
+'& m33p;-&.:-copy;-&;--x;' \
+'
+#text: & m33p;
+#text: -
+entity-reference: .:-copy
+#text: -
+#text: &;
+#text: -
+entity-reference: #
+#text: -
+entity-reference: #xx'
# Test >
test_output_equals \
'Parse processing instructions.' \
'
...
-' \
'
@@ -96,4 +126,19 @@ proc-instruction: xml -> encoding="UTF8"
#text: \n...\n
proc-instruction: ecmascript -> var val=2;\n'
+test_output_equals \
+'Skip spaces not inside text.' \
+'<
+root
+ns:attr
+=
+"value"
+>
+ target
+ data?>< / root >' \
+'
+element: root
+ attribute: ns:attr -> value
+ proc-instruction: target -> data'
+
test_done