diff options
| author | ljfa <ljfa-ag@web.de> | 2015-09-21 10:21:17 +0200 |
|---|---|---|
| committer | ljfa <ljfa-ag@web.de> | 2015-09-21 10:21:17 +0200 |
| commit | f76d4d228b32e72c7de250cb37af264d38ee7e79 (patch) | |
| tree | 5cf26b787a73a45f42198e957da19946b0e0ea85 /test/zlibstream_test.h | |
| parent | 28d735a3261e831f0c65cfe035e0aa53e369b964 (diff) | |
| download | Project-Tick-f76d4d228b32e72c7de250cb37af264d38ee7e79.tar.gz Project-Tick-f76d4d228b32e72c7de250cb37af264d38ee7e79.zip | |
Make close honor the exceptions mask
Diffstat (limited to 'test/zlibstream_test.h')
| -rw-r--r-- | test/zlibstream_test.h | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/test/zlibstream_test.h b/test/zlibstream_test.h index 204764e370..5f2ad64c55 100644 --- a/test/zlibstream_test.h +++ b/test/zlibstream_test.h @@ -224,12 +224,28 @@ public: void test_deflate_closed() { std::stringstream str; - ozlibstream ozls(str); - ozls.exceptions(std::ios::failbit | std::ios::badbit); - TS_ASSERT_THROWS_NOTHING(ozls << bigtest); - TS_ASSERT_THROWS_NOTHING(ozls.close()); - TS_ASSERT_THROWS(ozls << "foo" << std::flush, zlib_error); - TS_ASSERT(ozls.bad()); - TS_ASSERT(!str); + { + ozlibstream ozls(str); + ozls.exceptions(std::ios::failbit | std::ios::badbit); + TS_ASSERT_THROWS_NOTHING(ozls << bigtest); + TS_ASSERT_THROWS_NOTHING(ozls.close()); + TS_ASSERT_THROWS_NOTHING(ozls << "foo"); + TS_ASSERT_THROWS_ANYTHING(ozls.close()); + TS_ASSERT(ozls.bad()); + TS_ASSERT(!str); + } + str.clear(); + str.seekp(0); + { + ozlibstream ozls(str); + //this time without exceptions + TS_ASSERT_THROWS_NOTHING(ozls << bigtest); + TS_ASSERT_THROWS_NOTHING(ozls.close()); + TS_ASSERT_THROWS_NOTHING(ozls << "foo" << std::flush); + TS_ASSERT(ozls.bad()); + TS_ASSERT_THROWS_NOTHING(ozls.close()); + TS_ASSERT(ozls.bad()); + TS_ASSERT(!str); + } } }; |
