From 29fef9aca2f5832eb721f9d097d2a6f6ebdb0179 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sat, 11 Apr 2015 00:16:39 -0700 Subject: tests: Add more out of memory tests This provides more coverage for #17. --- tests/test_parse.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/test_parse.cpp') diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index 7bb2663..3ae96d1 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -926,6 +926,15 @@ TEST(parse_out_of_memory_halfway_attr) CHECK_STRING(doc.first_child().last_attribute().name(), STR("a")); } +TEST(parse_out_of_memory_conversion) +{ + test_runner::_memory_fail_threshold = 256; + + xml_document doc; + CHECK(doc.load_buffer("", 7, parse_default, encoding_latin1).status == status_out_of_memory); + CHECK(!doc.first_child()); +} + static bool test_offset(const char_t* contents, unsigned int options, pugi::xml_parse_status status, ptrdiff_t offset) { xml_document doc; -- cgit v1.2.3