summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-16 21:38:55 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-16 21:38:55 -0700
commit08f102f14c0d6b52d3fdeebc72bc05c1ddbf6867 (patch)
treee5140edb7fd913437c4dbf02633327d57f71bf5a /tests
parent86593c0999a6652be8e93556149cdbfdf410512b (diff)
tests: Add even more stream coverage tests
Apparently only narrow character streams had out of memory coverage - fix that and also split this into a separate test.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_document.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index bb5ed63..b702a07 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -109,12 +109,26 @@ TEST(document_load_stream_error)
std::ifstream fs("filedoesnotexist");
CHECK(doc.load(fs).status == status_io_error);
+}
+
+TEST(document_load_stream_out_of_memory)
+{
+ pugi::xml_document doc;
std::istringstream iss("<node/>");
test_runner::_memory_fail_threshold = 1;
CHECK_ALLOC_FAIL(CHECK(doc.load(iss).status == status_out_of_memory));
}
+TEST(document_load_stream_wide_out_of_memory)
+{
+ pugi::xml_document doc;
+
+ std::basic_istringstream<wchar_t> iss(L"<node/>");
+ test_runner::_memory_fail_threshold = 1;
+ CHECK_ALLOC_FAIL(CHECK(doc.load(iss).status == status_out_of_memory));
+}
+
TEST(document_load_stream_empty)
{
std::istringstream iss;