summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-10-03 14:28:18 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-10-03 14:28:18 +0000
commitf725ff1170e905a914e93daf6254640896a8c517 (patch)
treee0e3df7899b3afd6c2135ed898cb97b7a19647c2 /tests/test_document.cpp
parenta6c756b8bce21d88db10fdeffcb5e87c7d66c6b9 (diff)
tests: Fixed XPath OOM tests, added parsing exception test
git-svn-id: http://pugixml.googlecode.com/svn/trunk@760 99668b35-9821-0410-8761-19e4c4f06640
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