diff --git a/tests/copytests/cases/test031.sh b/tests/copytests/cases/test031.sh deleted file mode 100755 index 4955fd0f57..0000000000 --- a/tests/copytests/cases/test031.sh +++ /dev/null @@ -1,13 +0,0 @@ -# copy an empty directory to a non-existing directory without -r flag -# ensure the operation fails and the new file doesn't exist - -set -e -cd "$HOME/testcp" -mkdir foo - -wsh file copy foo bar >/dev/null 2>&1 && echo "the command should have failed" && exit 1 - -if [ -d bar ]; then - echo "bar should not exist" - exit 1 -fi diff --git a/tests/copytests/cases/test032.sh b/tests/copytests/cases/test032.sh index b321043758..e0577cb737 100755 --- a/tests/copytests/cases/test032.sh +++ b/tests/copytests/cases/test032.sh @@ -1,11 +1,11 @@ -# copy an empty directory to a non-existing directory with -r flag +# copy an empty directory to a non-existing directory # ensure the empty directory is copied to one with the new name set -e cd "$HOME/testcp" mkdir foo -wsh file copy -r foo bar +wsh file copy foo bar if [ ! -d bar ]; then echo "bar does not exist" diff --git a/tests/copytests/cases/test033.sh b/tests/copytests/cases/test033.sh deleted file mode 100755 index de4bdcf668..0000000000 --- a/tests/copytests/cases/test033.sh +++ /dev/null @@ -1,13 +0,0 @@ -# copy an empty directory ending with / to a non-existing directory without -r flag -# ensure the copy fails and the new directory doesn't exist - -set -e -cd "$HOME/testcp" -mkdir bar - -wsh file copy bar/ baz >/dev/null 2>&1 && echo "this command was supposed to fail" && exit 1 - -if [ -d baz ]; then - echo "baz should not exist" - exit 1 -fi diff --git a/tests/copytests/cases/test034.sh b/tests/copytests/cases/test034.sh index 8fa375634d..b8a0674918 100755 --- a/tests/copytests/cases/test034.sh +++ b/tests/copytests/cases/test034.sh @@ -1,11 +1,11 @@ -# copy an empty directory ending with / to a non-existing directory with -r flag +# copy an empty directory ending with / to a non-existing directory # ensure the copy succeeds and the new directory exists set -e cd "$HOME/testcp" mkdir bar -wsh file copy -r bar/ baz +wsh file copy bar/ baz if [ ! -d baz ]; then echo "baz does not exist" exit 1 diff --git a/tests/copytests/cases/test035.sh b/tests/copytests/cases/test035.sh deleted file mode 100755 index c2f0f0168e..0000000000 --- a/tests/copytests/cases/test035.sh +++ /dev/null @@ -1,12 +0,0 @@ -# copy an empty directory to a non-existing directory ending with / without -r flag -# ensure the copy fails and the new directory doesn't exist - -set -e -cd "$HOME/testcp" -mkdir bar - -wsh file copy bar baz/ >/dev/null 2>&1 && echo "this command was supposed to fail" && exit 1 -if [ -d baz ]; then - echo "baz should not exist" - exit 1 -fi diff --git a/tests/copytests/cases/test036.sh b/tests/copytests/cases/test036.sh index c8505c5a91..8905c95e59 100755 --- a/tests/copytests/cases/test036.sh +++ b/tests/copytests/cases/test036.sh @@ -1,11 +1,11 @@ -# copy an empty directory to a non-existing directory ending with / with -r flag +# copy an empty directory to a non-existing directory ending with / # ensure the copy succeeds and the new directory exists set -e cd "$HOME/testcp" mkdir bar -wsh file copy -r bar baz/ +wsh file copy bar baz/ if [ ! -d baz ]; then echo "baz does not exist" diff --git a/tests/copytests/cases/test037.sh b/tests/copytests/cases/test037.sh index 791a7f8c17..fd7adff948 100755 --- a/tests/copytests/cases/test037.sh +++ b/tests/copytests/cases/test037.sh @@ -1,11 +1,11 @@ -# copy an empty directory ending with // to a non-existing directory with -r flag +# copy an empty directory ending with // to a non-existing directory # ensure the copy succeeds and the new directory exists set -e cd "$HOME/testcp" mkdir bar -wsh file copy -r bar// baz +wsh file copy bar// baz if [ ! -d baz ]; then echo "baz does not exist" diff --git a/tests/copytests/cases/test038.sh b/tests/copytests/cases/test038.sh index e58de121ae..bcf5e51150 100755 --- a/tests/copytests/cases/test038.sh +++ b/tests/copytests/cases/test038.sh @@ -1,11 +1,11 @@ -# copy an empty directory to a non-existing directory ending with // with -r flag +# copy an empty directory to a non-existing directory ending with // # ensure the copy succeeds and the new directory exists set -e cd "$HOME/testcp" mkdir bar -wsh file copy -r bar baz// +wsh file copy bar baz// if [ ! -d baz ]; then echo "baz does not exist" diff --git a/tests/copytests/cases/test039.sh b/tests/copytests/cases/test039.sh deleted file mode 100755 index 149607a2a4..0000000000 --- a/tests/copytests/cases/test039.sh +++ /dev/null @@ -1,14 +0,0 @@ -# copy a directory containing a file to a new directory without -r flag -# ensure this fails and the new files don't exist - -set -e -cd "$HOME/testcp" -mkdir bar -touch bar/foo.txt - -wsh file copy bar baz >/dev/null 2>&1 && echo "this command should have failed" && exit 1 - -if [ -f baz/foo.txt ]; then - echo "baz/foo.txt should not exist" - exit 1 -fi diff --git a/tests/copytests/cases/test040.sh b/tests/copytests/cases/test040.sh index 1414635fce..23c482725d 100755 --- a/tests/copytests/cases/test040.sh +++ b/tests/copytests/cases/test040.sh @@ -1,4 +1,4 @@ -# copy a directory containing a file to a new directory with -r flag +# copy a directory containing a file to a new directory # ensure this succeeds and the new files exist set -e @@ -6,7 +6,7 @@ cd "$HOME/testcp" mkdir bar touch bar/foo.txt -wsh file copy -r bar baz +wsh file copy bar baz if [ ! -f baz/foo.txt ]; then echo "baz/foo.txt does not exist" diff --git a/tests/copytests/cases/test041.sh b/tests/copytests/cases/test041.sh index 1e04d917db..117789dc1d 100755 --- a/tests/copytests/cases/test041.sh +++ b/tests/copytests/cases/test041.sh @@ -1,4 +1,4 @@ -# copy a directory containing a file to an existing directory with -r flag +# copy a directory containing a file to an existing directory # ensure this succeeds and the new files are nested in the existing directory set -e @@ -7,7 +7,7 @@ mkdir bar touch bar/foo.txt mkdir baz -wsh file -r bar baz +wsh file copy bar baz if [ ! -f baz/bar/foo.txt ]; then echo "baz/bar/foo.txt does not exist" diff --git a/tests/copytests/cases/test042.sh b/tests/copytests/cases/test042.sh index 29831e9874..25b1fdb4df 100755 --- a/tests/copytests/cases/test042.sh +++ b/tests/copytests/cases/test042.sh @@ -1,4 +1,4 @@ -# copy a directory containing a file to an existing directory ending with / with -r flag +# copy a directory containing a file to an existing directory ending with / # ensure this succeeds and the new files are nested in the existing directory set -e @@ -7,7 +7,7 @@ mkdir bar touch bar/foo.txt mkdir baz -wsh file copy -r bar baz/ +wsh file copy bar baz/ if [ ! -f baz/bar/foo.txt ]; then echo "baz/bar/foo.txt does not exist" diff --git a/tests/copytests/cases/test043.sh b/tests/copytests/cases/test043.sh index 87160c68f8..8a1823ea46 100755 --- a/tests/copytests/cases/test043.sh +++ b/tests/copytests/cases/test043.sh @@ -1,4 +1,4 @@ -# copy a directory containing a file to an existing directory ending with /. with -r flag +# copy a directory containing a file to an existing directory ending with /. # ensure this succeeds and the new files are nested in the existing directory set -e @@ -7,7 +7,7 @@ mkdir bar touch bar/foo.txt mkdir baz -wsh file copy -r bar baz/. +wsh file copy bar baz/. if [ ! -f baz/bar/foo.txt ]; then echo "baz/bar/foo.txt does not exist" diff --git a/tests/copytests/cases/test044.sh b/tests/copytests/cases/test044.sh index 9a03245ce2..9353bd223e 100755 --- a/tests/copytests/cases/test044.sh +++ b/tests/copytests/cases/test044.sh @@ -1,4 +1,4 @@ -# copy a doubly nested directory containing a file to a non-existant directory with the -r flag +# copy a doubly nested directory containing a file to a non-existant directory # ensure this succeeds and the new files exist with the first directory renamed set -e @@ -7,7 +7,7 @@ mkdir foo mkdir foo/bar touch foo/bar/baz.txt -wsh file copy -r foo qux +wsh file copy foo qux if [ ! -f qux/bar/baz.txt ]; then echo "qux/bar/baz.txt does not exist" diff --git a/tests/copytests/cases/test045.sh b/tests/copytests/cases/test045.sh index 2dd232fb4b..87d9c4d688 100755 --- a/tests/copytests/cases/test045.sh +++ b/tests/copytests/cases/test045.sh @@ -1,4 +1,4 @@ -# copy a doubly nested directory containing a file to an existing directory with the -r flag +# copy a doubly nested directory containing a file to an existing directory # ensure this succeeds and the new files exist and are nested in the existing directory set -e @@ -8,7 +8,7 @@ mkdir foo/bar touch foo/bar/baz.txt mkdir qux -wsh file copy -r foo qux +wsh file copy foo qux if [ ! -f qux/foo/bar/baz.txt ]; then echo "qux/foo/bar/baz.txt does not exist" diff --git a/tests/copytests/cases/test048.sh b/tests/copytests/cases/test048.sh deleted file mode 100755 index c0001f2633..0000000000 --- a/tests/copytests/cases/test048.sh +++ /dev/null @@ -1,16 +0,0 @@ -# copy the current directory into an existing directory without the -r flag -# ensure the copy fails and the output doesn't exist - -set -e -cd "$HOME/testcp" -mkdir foo -touch foo/bar.txt -mkdir baz -cd foo - -wsh file copy . ../baz >/dev/null 2>&1 && echo "command should have failed" && exit 1 - -if [ -f baz/bar.txt ]; then - echo "baz/bar.txt should not exist" - exit 1 -fi diff --git a/tests/copytests/cases/test049.sh b/tests/copytests/cases/test049.sh index 2f3f943719..51d309a959 100755 --- a/tests/copytests/cases/test049.sh +++ b/tests/copytests/cases/test049.sh @@ -1,4 +1,4 @@ -# copy the current directory into an existing directory with the -r flag +# copy the current directory into an existing directory # ensure the copy succeeds and the output exists set -e @@ -8,7 +8,7 @@ touch foo/bar.txt mkdir baz cd foo -wsh file copy -r . ../baz +wsh file copy . ../baz cd .. if [ ! -f baz/bar.txt ]; then diff --git a/tests/copytests/cases/test050.sh b/tests/copytests/cases/test050.sh deleted file mode 100755 index 7b7bebd06c..0000000000 --- a/tests/copytests/cases/test050.sh +++ /dev/null @@ -1,15 +0,0 @@ -# copy the current directory into a non-existing directory without the -r flag -# ensure the copy fails and the output does not exist - -set -e -cd "$HOME/testcp" -mkdir foo -touch foo/bar.txt -cd foo - -wsh file copy . ../baz >/dev/null 2>&1 && echo "command should have failed" && exit 1 - -if [ -f baz/bar.txt ]; then - echo "baz/bar.txt should not exist" - exit 1 -fi diff --git a/tests/copytests/cases/test051.sh b/tests/copytests/cases/test051.sh index 0d625b660d..3008c14653 100755 --- a/tests/copytests/cases/test051.sh +++ b/tests/copytests/cases/test051.sh @@ -1,4 +1,4 @@ -# copy the current directory into a non-existing directory with the -r flag +# copy the current directory into a non-existing directory # ensure the copy succeeds and the output exists set -e @@ -7,7 +7,7 @@ mkdir foo touch foo/bar.txt cd foo -wsh file copy -r . ../baz +wsh file copy . ../baz cd .. if [ ! -f baz/bar.txt ]; then diff --git a/tests/copytests/cases/test052.sh b/tests/copytests/cases/test052.sh index 5010c3305c..2da8110fe7 100755 --- a/tests/copytests/cases/test052.sh +++ b/tests/copytests/cases/test052.sh @@ -14,7 +14,7 @@ mkdir corge # we need a nested corge/foo so the foo.zip contains the same exact file names # in other words, if one file was named foo and the other was corge, they would # not match. this allows them to be the same. -wsh file copy -r foo corge/foo +wsh file copy foo corge/foo zip -r foo.zip foo >/dev/null 2>&1 diff --git a/tests/copytests/runner.sh b/tests/copytests/runner.sh index d48e3415a3..0e1eddb1e3 100755 --- a/tests/copytests/runner.sh +++ b/tests/copytests/runner.sh @@ -3,13 +3,22 @@ cd "$(dirname "$0")" source testutil.sh +TOTAL_COPY_TESTS_RUN=0 +TOTAL_COPY_TESTS_PASSED=0 + for fname in cases/*.sh; do setup_testcp #"${fname}" | read outerr && printf "\e[32mPASS $fname\n\n\e[0m" || printf "\e[31mFAIL $fname: $outerr \n\n\e[0m" if ! outerr=$("${fname}" 2>&1); then - printf "\e[31mFAIL $fname:\n$outerr \n\n\e[0m" + printf "\e[31mFAIL $fname:\n$outerr \n\e[0m" + cat "${fname}" + printf "\n" else printf "\e[32mPASS $fname\n\n\e[0m" + ((TOTAL_COPY_TESTS_PASSED++)) fi cleanup_testcp -done \ No newline at end of file + ((TOTAL_COPY_TESTS_RUN++)) +done + +printf "\n\e[32m${TOTAL_COPY_TESTS_PASSED} of ${TOTAL_COPY_TESTS_RUN} Tests Passed \e[0m\n\n" \ No newline at end of file