From 08f102f14c0d6b52d3fdeebc72bc05c1ddbf6867 Mon Sep 17 00:00:00 2001
From: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Date: Fri, 16 Jun 2017 21:38:55 -0700
Subject: [PATCH] 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.
---
 tests/test_document.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index bb5ed637..b702a077 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;
-- 
GitLab