summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2016-11-09 09:12:36 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2016-11-09 09:12:36 -0800
commit1649b2e6b89c5eabd5ccf68a815d22ceaed0ddee (patch)
treef036993834baefaf554bb75d6586454999a2ca33
parentcd7e0b04f6851490c46d1a038764a9a7f44af232 (diff)
tests: Add a test for format_no_empty_element_tags
-rw-r--r--tests/test_write.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index bf45e31..8fbcc27 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -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
{