diff options
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r-- | tests/test_document.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 35f3f7d..85a63a7 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -108,15 +108,17 @@ TEST(document_load_stream_exceptions) { pugi::xml_document doc; + // Windows has newline translation for text-mode files, so reading from this stream reaches eof and sets fail|eof bits. + // This test does not cause stream to throw an exception on Linux - I have no idea how to get read() to fail except + // newline translation. std::ifstream iss("tests/data/multiline.xml"); - iss.exceptions(std::ios::eofbit); + iss.exceptions(std::ios::eofbit | std::ios::badbit | std::ios::failbit); try { doc.load(iss); - volatile bool exception_should_be_thrown = false; // to avoid 'controlling expression is constant' warning - CHECK(exception_should_be_thrown); + CHECK(iss.good()); // if the exception was not thrown, stream reading should succeed without errors } catch (const std::ios_base::failure&) { |