summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-22 05:09:50 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-22 05:09:50 +0000
commit2ac60c851e351fd69ea8aa8b58ef6953b1792a35 (patch)
tree2c7266f78ec6aa8cbdeff26419976cc395b5f173 /tests/test_document.cpp
parent04085a8875d30cb39ccfd0e99b3d0aa098f17d6d (diff)
tests: Added stream exception test
git-svn-id: http://pugixml.googlecode.com/svn/trunk@611 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r--tests/test_document.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 1f781e2..abc676e 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -102,6 +102,26 @@ TEST(document_load_stream_wide)
CHECK(doc.load(iss));
CHECK_NODE(doc, STR("<node />"));
}
+
+#ifndef PUGIXML_NO_EXCEPTIONS
+TEST(document_load_stream_exceptions)
+{
+ pugi::xml_document doc;
+
+ std::ifstream iss("tests/data/multiline.xml");
+ iss.exceptions(std::ios::eofbit);
+
+ try
+ {
+ doc.load(iss);
+ CHECK((bool)!"exception should be thrown");
+ }
+ catch (const std::ios_base::failure&)
+ {
+ CHECK(!doc.first_child());
+ }
+}
+#endif
#endif
TEST(document_load_string)