aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-06-24 22:55:13 +0000
committerRob Landley <rob@landley.net>2006-06-24 22:55:13 +0000
commit641c3537c0bf63793a6195108a1d2e682ed4cba1 (patch)
tree22cf82890d9cbd90e1bc54038afe2b320caf5c14
parente1ee4826843e82ffd1d5f9f4cfb0f77ac6c8420e (diff)
downloadbusybox-641c3537c0bf63793a6195108a1d2e682ed4cba1.tar.gz
Add a test from Glenn.
-rwxr-xr-xtestsuite/unzip.tests38
1 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
new file mode 100755
index 000000000..77814886f
--- /dev/null
+++ b/testsuite/unzip.tests
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Tests for unzip.
+# Copyright 2006 Rob Landley <rob@landley.net>
+# Copyright 2006 Glenn McGrath <bug1@ihug.co.nz>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+# file input will be file called "input"
+# test can create a file "actual" instead of writing to stdout
+
+# Create a scratch directory
+
+mkdir temp
+cd temp
+
+# Create test file to work with.
+
+mkdir foo
+touch foo/bar
+zip foo.zip foo foo/bar > /dev/null
+rm -f foo/bar
+rmdir foo
+
+# Test that unzipping just foo doesn't create bar.
+testing "unzip (subdir only)" "unzip -q foo.zip foo/ && test -d foo && test ! -f foo/bar && echo yes" "yes\n" "" ""
+
+rmdir foo
+rm foo.zip
+
+# Clean up scratch directory.
+
+cd ..
+rm -rf temp
+
+exit $FAILCOUNT