On Thu, Apr 20, 2017 at 06:52:30PM +0200, SZEDER Gábor wrote:
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 13b569682..e9e6f677d 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -761,9 +761,12 @@ test_done () {
> say "1..$test_count$skip_all"
> fi
>
> - test -d "$remove_trash" &&
> + test -d "$remove_trash" ||
> + error "Tests passed but trash directory already removed before
> test cleanup; aborting"
I think I found out why this "test -d" was here in the first place:
$ ./t0000-basic.sh --debug
[...]
# passed all 77 test(s)
1..77
error: Tests passed but trash directory already removed before test cleanup;
aborting
When --debug is in use, we do not set $remove_trash. The original was
relying on 'test -d ""' to return false.
I think this whole removal block should probably be moved inside a
conditional like:
if test -n "$remove_trash"
then
...
fi
I also wonder if we should come up with a better name than
$remove_trash. A script which unknowingly overwrites that variable would
be disastrous.
Perhaps we should drop it entirely and just do:
if test -z "$debug"
then
test -d "$TRASH_DIRECTORY" ||
error "Tests passed but..."
[and so forth...]
fi
-Peff