From a747f09fba0796dd7d1f49f6180150ab0c114f0b Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Sun, 23 Apr 2017 17:45:54 +0200 Subject: [PATCH] add testcase for bins/zzip (when -D_ZZIO_ENABLE_WRITE) --- bins/zzip.c | 6 +++++- test/zziptests.py | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bins/zzip.c b/bins/zzip.c index a1e990c..2869a36 100644 --- a/bins/zzip.c +++ b/bins/zzip.c @@ -43,7 +43,11 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); +# if defined _ZZIP_ENABLE_WRITE + printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION" - W/ -D_ZZIP_ENABLE_WRITE\n"); +# else + printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION" - NO -D_ZZIP_ENABLE_WRITE\n"); +# endif return 0; } diff --git a/test/zziptests.py b/test/zziptests.py index cd57f12..64ec2c0 100644 --- a/test/zziptests.py +++ b/test/zziptests.py @@ -513,6 +513,27 @@ class ZZipTest(unittest.TestCase): getfile = "test4x/file.999" run = shell("{exe} {getfile}".format(**locals())) self.assertEqual("file-999\n", run.output) + def test_401_make_test1w_zip(self): + """ create a test1w.zip using zzip/write functions. """ + exe=self.bins("zzip") + run = shell("{exe} --version".format(**locals())) + if "- NO -" in run.output: + self.skipTest("- NO -D_ZZIP_ENABLE_WRITE") + return + zipfile="test1w.zip" + tmpdir="test1w.tmp" + exe=self.bins("zzip") + for i in [1,2,3,4,5,6,7,8,9]: + filename = os.path.join(tmpdir,"file.%i" % i) + filetext = "file-%i\n" % i + self.mkfile(filename, filetext) + filename = os.path.join(tmpdir,"README") + filetext = self.readme() + self.mkfile(filename, filetext) + try: os.remove(zipfile) + except: pass + shell("../{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir) + self.assertGreater(os.path.getsize(zipfile), 10) -- 2.40.0