From 021574a48430b6cc5589a76e7d02b1fc6a25849d Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sat, 8 May 2010 16:44:04 +0000 Subject: Added 0.5-compatible interfaces for compatibility git-svn-id: http://pugixml.googlecode.com/svn/trunk@386 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_deprecated.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/test_deprecated.cpp (limited to 'tests') diff --git a/tests/test_deprecated.cpp b/tests/test_deprecated.cpp new file mode 100644 index 0000000..e251876 --- /dev/null +++ b/tests/test_deprecated.cpp @@ -0,0 +1,55 @@ +// This file includes all tests for deprecated functionality; this is going away in the next release! + +#include + +#include "common.hpp" + +#include "writer_string.hpp" + +// format_write_bom_utf8 - it's now format_write_bom! +TEST_XML(document_save_bom_utf8, "") +{ + 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", 11)); +} + +// parse - it's now load_buffer_inplace +TEST(document_parse) +{ + char text[] = ""; + + pugi::xml_document doc; + + CHECK(doc.parse(text)); + CHECK_NODE(doc, STR("")); +} + +// parse with transfer_ownership_tag attribute - it's now load_buffer_inplace_own +TEST(document_parse_transfer_ownership) +{ + allocation_function alloc = get_memory_allocation_function(); + + char* text = static_cast(alloc(strlen("") + 1)); + CHECK(text); + + memcpy(text, "", strlen("") + 1); + + pugi::xml_document doc; + + CHECK(doc.parse(transfer_ownership_tag(), text)); + CHECK_NODE(doc, STR("")); +} + +// as_utf16 - it's now as_wide +TEST(as_utf16) +{ + CHECK(as_utf16("") == L""); + + // valid 1-byte, 2-byte and 3-byte inputs +#ifdef U_LITERALS + CHECK(as_utf16("?\xd0\x80\xe2\x80\xbd") == L"?\u0400\u203D"); +#else + CHECK(as_utf16("?\xd0\x80\xe2\x80\xbd") == L"?\x0400\x203D"); +#endif +} -- cgit v1.2.3