0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 21:04:25 +08:00

tests: Add a test for format_no_empty_element_tags

This commit is contained in:
Arseny Kapoulkine 2016-11-09 09:12:36 -08:00
parent cd7e0b04f6
commit 1649b2e6b8

View File

@ -601,6 +601,13 @@ TEST_XML_FLAGS(write_mixed, "<node><child1/><child2>pre<![CDATA[data]]>mid<!--co
CHECK_NODE_EX(doc, STR("<node>\n\t<child1 />\n\t<child2>pre<![CDATA[data]]>mid<!--comment-->\n\t\t<test />post<?pi value?>fin</child2>\n\t<child3 />\n</node>\n"), STR("\t"), format_indent);
}
TEST_XML(write_no_empty_element_tags, "<node><child1/><child2>text</child2><child3></child3></node>")
{
CHECK_NODE(doc, STR("<node><child1/><child2>text</child2><child3/></node>"));
CHECK_NODE_EX(doc, STR("<node><child1></child1><child2>text</child2><child3></child3></node>"), STR("\t"), format_raw | format_no_empty_element_tags);
CHECK_NODE_EX(doc, STR("<node>\n\t<child1></child1>\n\t<child2>text</child2>\n\t<child3></child3>\n</node>\n"), STR("\t"), format_indent | format_no_empty_element_tags);
}
#ifndef PUGIXML_NO_EXCEPTIONS
struct throwing_writer: pugi::xml_writer
{