summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r--tests/test_document.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index d67f646..d6163e2 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -845,3 +845,24 @@ TEST(document_load_buffer_inplace_short)
delete[] data;
}
+
+#ifndef PUGIXML_NO_EXCEPTIONS
+TEST(document_load_exceptions)
+{
+ bool thrown = false;
+
+ try
+ {
+ pugi::xml_document doc;
+ if (!doc.load("<node attribute='value")) throw std::bad_alloc();
+
+ CHECK_FORCE_FAIL("Expected parsing failure");
+ }
+ catch (const std::bad_alloc&)
+ {
+ thrown = true;
+ }
+
+ CHECK(thrown);
+}
+#endif