summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Degros <fdegros@chromium.org>2022-02-09 21:51:25 +0000
committerCopybara-Service <copybara-worker@google.com>2022-02-09 14:00:58 -0800
commit9973d8bc57b59a3ce4cec5494d2153b2c8f85974 (patch)
treefe4f60b739c89bde088882241f0b6c76d9646681
parent9dcc674af38c1ccb5dbe03a77f828a4bfc427676 (diff)
downloadzlib-9973d8bc57b59a3ce4cec5494d2153b2c8f85974.tar.gz
[zip] Add test ZipReaderTest.Open_EmptyFile
BUG=chromium:1295127 TEST=autoninja -C out/Default zlib_unittests && out/Default/zlib_unittests Change-Id: Ia50d5911047ec6347872e62f1f4c4de9650d7394 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3447717 Reviewed-by: Noel Gordon <noel@chromium.org> Commit-Queue: François Degros <fdegros@chromium.org> Cr-Commit-Position: refs/heads/main@{#969125} NOKEYCHECK=True GitOrigin-RevId: 57f8a7470fe498336643bd0ef8a7d2499b5d280f
-rw-r--r--google/test/data/empty.zipbin0 -> 22 bytes
-rw-r--r--google/zip_reader_unittest.cc5
2 files changed, 5 insertions, 0 deletions
diff --git a/google/test/data/empty.zip b/google/test/data/empty.zip
new file mode 100644
index 0000000..15cb0ec
--- /dev/null
+++ b/google/test/data/empty.zip
Binary files differ
diff --git a/google/zip_reader_unittest.cc b/google/zip_reader_unittest.cc
index b0347e8..d2752ee 100644
--- a/google/zip_reader_unittest.cc
+++ b/google/zip_reader_unittest.cc
@@ -216,6 +216,11 @@ TEST_F(ZipReaderTest, Open_ExistentButNonZipFile) {
ASSERT_FALSE(reader.Open(data_dir_.AppendASCII("create_test_zip.sh")));
}
+TEST_F(ZipReaderTest, Open_EmptyFile) {
+ ZipReader reader;
+ EXPECT_FALSE(reader.Open(data_dir_.AppendASCII("empty.zip")));
+}
+
// Iterate through the contents in the test ZIP archive, and compare that the
// contents collected from the ZipReader matches the expected contents.
TEST_F(ZipReaderTest, Iteration) {