tryopen already tests get_num_entries; convert new test to that and remove duplicates. --HG-- branch : HEAD
diff --git a/regress/CMakeLists.txt b/regress/CMakeLists.txt index 5b8ada5..ab5981f 100644 --- a/regress/CMakeLists.txt +++ b/regress/CMakeLists.txt
@@ -17,19 +17,15 @@ ) SET(HELPER_TEST_PROGRAMS - get_num_entries rename set_compression tryopen ) SET(EXTRA_TESTS - get_num_entries_0.test - get_num_entries_0b.test - get_num_entries_4.test - get_num_entries_70000.test open_cons_extrabytes.test open_empty.test + open_empty_2.test open_extrabytes.test open_new_but_exists.test open_new_ok.test
diff --git a/regress/Makefile.am b/regress/Makefile.am index 1defca5..4b673c5 100644 --- a/regress/Makefile.am +++ b/regress/Makefile.am
@@ -8,7 +8,6 @@ fopen_unchanged \ fread \ get_comment \ - get_num_entries \ name_locate \ rename \ set_comment_all \ @@ -56,13 +55,10 @@ fopen_unchanged.test \ fread.test \ get_comment.test \ - get_num_entries_0.test \ - get_num_entries_0b.test \ - get_num_entries_4.test \ - get_num_entries_70000.test \ name_locate.test \ open_cons_extrabytes.test \ open_empty.test \ + open_empty_2.test \ open_extrabytes.test \ open_many_ok.test \ open_new_but_exists.test \
diff --git a/regress/get_num_entries.c b/regress/get_num_entries.c deleted file mode 100644 index 6743aff..0000000 --- a/regress/get_num_entries.c +++ /dev/null
@@ -1,77 +0,0 @@ -/* - get_num_entries.c -- print number of entries in ZIP archive - Copyright (C) 2012 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at <libzip@nih.at> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include <errno.h> - -#include "zip.h" - -const char *prg; - -int -main(int argc, char *argv[]) -{ - const char *archive; - struct zip *za; - char buf[100]; - int err; - const char *com; - zip_uint64_t num; - - prg = argv[0]; - - if (argc != 2) { - fprintf(stderr, "usage: %s archive\n", prg); - return 1; - } - - archive = argv[1]; - - if ((za=zip_open(archive, 0, &err)) == NULL) { - zip_error_to_str(buf, sizeof(buf), err, errno); - fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, - archive, buf); - return 1; - } - - num = zip_get_num_files(za); - printf("%lld\n", num); - - if (zip_close(za) == -1) { - fprintf(stderr, "%s: can't close zip archive `%s': %s\n", prg, archive, zip_strerror(za)); - return 1; - } - - return 0; -}
diff --git a/regress/get_num_entries_0.test b/regress/get_num_entries_0.test deleted file mode 100755 index 7dbbfe5..0000000 --- a/regress/get_num_entries_0.test +++ /dev/null
@@ -1,6 +0,0 @@ -# list number of entries in zip archive -program get_num_entries -return 0 -args testfile.txt -file testfile.txt testfile.txt testfile.txt -stdout 0
diff --git a/regress/get_num_entries_0b.test b/regress/get_num_entries_0b.test deleted file mode 100755 index 413f8ae..0000000 --- a/regress/get_num_entries_0b.test +++ /dev/null
@@ -1,6 +0,0 @@ -# list number of entries in zip archive -program get_num_entries -return 0 -args testempty.arg -file testempty.arg testempty.zip testempty.zip -stdout 0
diff --git a/regress/get_num_entries_4.test b/regress/get_num_entries_4.test deleted file mode 100755 index dd46d12..0000000 --- a/regress/get_num_entries_4.test +++ /dev/null
@@ -1,6 +0,0 @@ -# list number of entries in zip archive -program get_num_entries -return 0 -args testcomment.zip -file testcomment.zip testcomment.zip testcomment.zip -stdout 4
diff --git a/regress/get_num_entries_70000.test b/regress/get_num_entries_70000.test deleted file mode 100755 index 7046196..0000000 --- a/regress/get_num_entries_70000.test +++ /dev/null
@@ -1,6 +0,0 @@ -# list number of entries in zip archive -program get_num_entries -return 0 -args manyfiles.zip -file manyfiles.zip manyfiles.zip manyfiles.zip -stdout 70000
diff --git a/regress/open_empty_2.test b/regress/open_empty_2.test new file mode 100644 index 0000000..0f6e215 --- /dev/null +++ b/regress/open_empty_2.test
@@ -0,0 +1,6 @@ +# zip_open: 0 size file is recognized as empty zip +program tryopen +file testfile.txt testfile.txt testfile.txt +args testfile.txt +return 0 +stdout opening `testfile.txt' succeeded, 0 entries