From 87d4f03187c66181c47696f879542b5bf911e8c4 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 14 Oct 2014 04:11:26 +0000 Subject: tests: Add a test for printing comments that contain -- git-svn-id: https://pugixml.googlecode.com/svn/trunk@1059 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_write.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') 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, "", parse_comments | parse_fragment) CHECK_NODE_EX(doc, STR("\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, "", parse_pi | parse_fragment) { CHECK_NODE(doc, STR("")); -- cgit v1.2.3