0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-14 01:47:55 +08:00

tests: Add a test for printing comments that contain --

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1059 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
Arseny Kapoulkine 2014-10-14 04:11:26 +00:00
parent e7d2540c1a
commit 87d4f03187

View File

@ -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?>"));