diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /unittests/Support/CompressionTest.cpp | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
Diffstat (limited to 'unittests/Support/CompressionTest.cpp')
-rw-r--r-- | unittests/Support/CompressionTest.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/unittests/Support/CompressionTest.cpp b/unittests/Support/CompressionTest.cpp index 36b84d85f22b..18a6175460d3 100644 --- a/unittests/Support/CompressionTest.cpp +++ b/unittests/Support/CompressionTest.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Compression.h" +#include "llvm/Support/Error.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Config/config.h" @@ -26,15 +27,21 @@ namespace { void TestZlibCompression(StringRef Input, zlib::CompressionLevel Level) { SmallString<32> Compressed; SmallString<32> Uncompressed; - EXPECT_EQ(zlib::StatusOK, zlib::compress(Input, Compressed, Level)); + + Error E = zlib::compress(Input, Compressed, Level); + EXPECT_FALSE(E); + consumeError(std::move(E)); + // Check that uncompressed buffer is the same as original. - EXPECT_EQ(zlib::StatusOK, - zlib::uncompress(Compressed, Uncompressed, Input.size())); + E = zlib::uncompress(Compressed, Uncompressed, Input.size()); + EXPECT_FALSE(E); + consumeError(std::move(E)); + EXPECT_EQ(Input, Uncompressed); if (Input.size() > 0) { // Uncompression fails if expected length is too short. - EXPECT_EQ(zlib::StatusBufferTooShort, - zlib::uncompress(Compressed, Uncompressed, Input.size() - 1)); + E = zlib::uncompress(Compressed, Uncompressed, Input.size() - 1); + EXPECT_EQ("zlib error: Z_BUF_ERROR", llvm::toString(std::move(E))); } } |