unzip.tests 801 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. # Tests for unzip.
  3. # Copyright 2006 Rob Landley <rob@landley.net>
  4. # Copyright 2006 Glenn McGrath <bug1@ihug.co.nz>
  5. # Licensed under GPL v2, see file LICENSE for details.
  6. . testing.sh
  7. # testing "test name" "options" "expected result" "file input" "stdin"
  8. # file input will be file called "input"
  9. # test can create a file "actual" instead of writing to stdout
  10. # Create a scratch directory
  11. mkdir temp
  12. cd temp
  13. # Create test file to work with.
  14. mkdir foo
  15. touch foo/bar
  16. zip foo.zip foo foo/bar > /dev/null
  17. rm -f foo/bar
  18. rmdir foo
  19. # Test that unzipping just foo doesn't create bar.
  20. testing "unzip (subdir only)" "unzip -q foo.zip foo/ && test -d foo && test ! -f foo/bar && echo yes" "yes\n" "" ""
  21. rmdir foo
  22. rm foo.zip
  23. # Clean up scratch directory.
  24. cd ..
  25. rm -rf temp
  26. exit $FAILCOUNT