diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_deprecated.cpp | 8 | ||||
-rw-r--r-- | tests/test_document.cpp | 11 | ||||
-rw-r--r-- | tests/test_dom_traverse.cpp | 1 |
3 files changed, 12 insertions, 8 deletions
diff --git a/tests/test_deprecated.cpp b/tests/test_deprecated.cpp index 3f7ecb0..5c4f566 100644 --- a/tests/test_deprecated.cpp +++ b/tests/test_deprecated.cpp @@ -25,14 +25,6 @@ #include <vector> #include <iterator> -// format_write_bom_utf8 - it's now format_write_bom! -TEST_XML(document_save_bom_utf8, "<node/>") -{ - xml_writer_string writer; - - CHECK(test_save_narrow(doc, pugi::format_no_declaration | pugi::format_raw | pugi::format_write_bom_utf8, encoding_utf8, "\xef\xbb\xbf<node />", 11)); -} - // parse - it's now load_buffer_inplace TEST(document_parse) { diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 37ec021..bb86992 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -267,6 +267,17 @@ TEST_XML(document_save_declaration, "<node/>") CHECK(writer.as_string() == STR("<?xml version=\"1.0\"?>\n<node />\n")); } +TEST(document_save_declaration_empty) +{ + xml_document doc; + + xml_writer_string writer; + + doc.save(writer, STR(""), pugi::format_default, get_native_encoding()); + + CHECK(writer.as_string() == STR("<?xml version=\"1.0\"?>\n")); +} + TEST_XML(document_save_declaration_present_first, "<node/>") { doc.insert_child_before(node_declaration, doc.first_child()).append_attribute(STR("encoding")) = STR("utf8"); diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index c647a79..18d59a4 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -440,6 +440,7 @@ TEST_XML(dom_node_child_value, "<node><novalue/><child1>value1</child1><child2>v CHECK_STRING(node.child(STR("child2")).child_value(), STR("value2")); CHECK_STRING(node.child(STR("child3")).child_value(), STR("value3")); CHECK_STRING(node.child_value(STR("child3")), STR("value3")); + CHECK_STRING(node.child_value(STR("novalue")), STR("")); } TEST_XML(dom_node_first_last_attribute, "<node attr1='0' attr2='1'/>") |