diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-14 04:11:26 +0000 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-14 04:11:26 +0000 |
commit | 87d4f03187c66181c47696f879542b5bf911e8c4 (patch) | |
tree | f80d78c97504bdb2cc9ef41e2cb6efadd23188d6 /tests | |
parent | e7d2540c1a1be4c4f69d64771cfddfaf0fc6556a (diff) |
tests: Add a test for printing comments that contain --
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1059 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_write.cpp | 23 |
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?>")); |