summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-21 05:50:53 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-21 05:50:53 +0000
commit7c01cf8df31ed0636d12d907d32cfc3cfbc452ea (patch)
tree2ef7d0d9377b76ba65fba8ef67a1d7b2a212c267 /tests
parente31d977c8096fd9566bda50d16e843042fe36a50 (diff)
Nodes/attributes with empty names now are printed as :anonymous
git-svn-id: http://pugixml.googlecode.com/svn/trunk@441 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests')
-rw-r--r--tests/test_write.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index c94ab89..64e50b5 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -306,4 +306,32 @@ TEST(write_unicode_invalid_utf8)
CHECK(test_write_unicode_invalid("a\xf8_", L"a_"));
}
+TEST(write_no_name_element)
+{
+ xml_document doc;
+ xml_node root = doc.append_child();
+ root.append_child();
+ root.append_child().append_child(node_pcdata).set_value("text");
+
+ CHECK_NODE(doc, "<:anonymous><:anonymous /><:anonymous>text</:anonymous></:anonymous>");
+ CHECK_NODE_EX(doc, "<:anonymous>\n\t<:anonymous />\n\t<:anonymous>text</:anonymous>\n</:anonymous>\n", "\t", format_default);
+}
+
+TEST(write_no_name_pi)
+{
+ xml_document doc;
+ doc.append_child(node_pi);
+
+ CHECK_NODE(doc, "<?:anonymous?>");
+}
+
+TEST(write_no_name_attribute)
+{
+ xml_document doc;
+ doc.append_child().set_name("root");
+ doc.child("root").append_attribute("");
+
+ CHECK_NODE(doc, "<root :anonymous=\"\" />");
+}
+
#endif