summaryrefslogtreecommitdiff
path: root/tests/test_parse.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-11 00:16:39 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-11 00:16:39 -0700
commit29fef9aca2f5832eb721f9d097d2a6f6ebdb0179 (patch)
treec66aec5d90db94633d72ff47d879dacbad15ef46 /tests/test_parse.cpp
parent405fefc8777c55900a4e44561b545a9abb5276ba (diff)
tests: Add more out of memory tests
This provides more coverage for #17.
Diffstat (limited to 'tests/test_parse.cpp')
-rw-r--r--tests/test_parse.cpp9
1 files changed, 9 insertions, 0 deletions
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("<foo\x90/>", 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;