summaryrefslogtreecommitdiff
path: root/tests/test_write.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_write.cpp')
-rw-r--r--tests/test_write.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index 0c20e26..98650ac 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -57,6 +57,29 @@ TEST_XML_FLAGS(write_comment, "<!--text-->", parse_comments | parse_fragment)
CHECK_NODE_EX(doc, STR("<!--text-->\n"), STR(""), 0);
}
+TEST(write_comment_invalid)
+{
+ xml_document doc;
+ xml_node child = doc.append_child(node_comment);
+
+ CHECK_NODE(doc, STR("<!---->"));
+
+ child.set_value(STR("-"));
+ CHECK_NODE(doc, STR("<!--- -->"));
+
+ child.set_value(STR("--"));
+ CHECK_NODE(doc, STR("<!--- - -->"));
+
+ child.set_value(STR("---"));
+ CHECK_NODE(doc, STR("<!--- - - -->"));
+
+ child.set_value(STR("-->"));
+ CHECK_NODE(doc, STR("<!--- ->-->"));
+
+ child.set_value(STR("-->-"));
+ CHECK_NODE(doc, STR("<!--- ->- -->"));
+}
+
TEST_XML_FLAGS(write_pi, "<?name value?>", parse_pi | parse_fragment)
{
CHECK_NODE(doc, STR("<?name value?>"));