From 7c01cf8df31ed0636d12d907d32cfc3cfbc452ea Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Fri, 21 May 2010 05:50:53 +0000 Subject: 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 --- tests/test_write.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/test_write.cpp') 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"); + CHECK_NODE_EX(doc, "<:anonymous>\n\t<:anonymous />\n\t<:anonymous>text\n\n", "\t", format_default); +} + +TEST(write_no_name_pi) +{ + xml_document doc; + doc.append_child(node_pi); + + CHECK_NODE(doc, ""); +} + +TEST(write_no_name_attribute) +{ + xml_document doc; + doc.append_child().set_name("root"); + doc.child("root").append_attribute(""); + + CHECK_NODE(doc, ""); +} + #endif -- cgit v1.2.3