summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorljfa <ljfa-ag@web.de>2015-09-21 08:56:39 +0200
committerljfa <ljfa-ag@web.de>2015-09-21 08:56:39 +0200
commit28d735a3261e831f0c65cfe035e0aa53e369b964 (patch)
tree5dd76aacf48deb1fab6fe101a6868d6e3cd9cc61
parentc7ca7fc947527a831ab21a6449a7b5f71bf1e382 (diff)
downloadProject-Tick-28d735a3261e831f0c65cfe035e0aa53e369b964.tar.gz
Project-Tick-28d735a3261e831f0c65cfe035e0aa53e369b964.zip
Add test for writing to a closed ozlibstream
-rw-r--r--test/zlibstream_test.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/zlibstream_test.h b/test/zlibstream_test.h
index 9ce411b6c1..204764e370 100644
--- a/test/zlibstream_test.h
+++ b/test/zlibstream_test.h
@@ -220,4 +220,16 @@ public:
}
TS_ASSERT_EQUALS(output.str(), bigtest);
}
+
+ 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);
+ }
};