diff options
Diffstat (limited to 'unzip/test/test_x.c')
-rw-r--r-- | unzip/test/test_x.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/unzip/test/test_x.c b/unzip/test/test_x.c index 21f01bf65da8..d55376849ce9 100644 --- a/unzip/test/test_x.c +++ b/unzip/test/test_x.c @@ -25,8 +25,8 @@ */ #include "test.h" -/* Test x arg - Exclude paths */ -DEFINE_TEST(test_x) +/* Test x arg with single exclude path */ +DEFINE_TEST(test_x_single) { const char *reffile = "test_basic.zip"; int r; @@ -42,3 +42,39 @@ DEFINE_TEST(test_x) assertFileNotExists("test_basic/c"); assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); } + +/* Test x arg with multiple exclude paths */ +DEFINE_TEST(test_x_multiple) +{ + const char *reffile = "test_basic.zip"; + int r; + + extract_reference_file(reffile); + r = systemf("%s %s -x test_basic/c test_basic/b >test.out 2>test.err", testprog, reffile); + assertEqualInt(0, r); + assertNonEmptyFile("test.out"); + assertEmptyFile("test.err"); + + assertTextFileContents("contents a\n", "test_basic/a"); + assertFileNotExists("test_basic/b"); + assertFileNotExists("test_basic/c"); + assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +} + +/* Test x arg with multiple exclude paths and a d arg afterwards */ +DEFINE_TEST(test_x_multiple_with_d) +{ + const char *reffile = "test_basic.zip"; + int r; + + extract_reference_file(reffile); + r = systemf("%s %s -x test_basic/c test_basic/b -d foobar >test.out 2>test.err", testprog, reffile); + assertEqualInt(0, r); + assertNonEmptyFile("test.out"); + assertEmptyFile("test.err"); + + assertTextFileContents("contents a\n", "foobar/test_basic/a"); + assertFileNotExists("foobar/test_basic/b"); + assertFileNotExists("foobar/test_basic/c"); + assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS"); +} |