summaryrefslogtreecommitdiff
path: root/tests/test_write.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-20 20:34:28 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-20 20:34:28 -0700
commitd7ac5e2e0cb0521af1628e95774ad418af82af58 (patch)
tree2fca26ab47941b0511de460de0fc58f0a2882024 /tests/test_write.cpp
parentfcd1876a21593bd62580383874b57c734d629a0c (diff)
parent7258aea09be1847b3dcc99ca389990027d4a92d3 (diff)
Merge branch 'master' into compact
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?>"));