diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2018-08-19 23:57:22 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-21 11:48:29 -0700 |
commit | ec10b018e76b3f4f40db96a24202c6b8c056bd0f (patch) | |
tree | fca8ac2204c583b2aec884c7a87541f11d117735 /t/t1501-work-tree.sh | |
parent | tests: make use of the test_must_be_empty function (diff) | |
download | tgif-ec10b018e76b3f4f40db96a24202c6b8c056bd0f.tar.xz |
tests: use 'test_must_be_empty' instead of '! test -s'
Using 'test_must_be_empty' is preferable to '! test -s', because it
gives a helpful error message if the given file is unexpectedly not
empty, while the latter remains completely silent. Furthermore, it
also catches cases when the given file unexpectedly does not exist at
all.
This patch was basically created by:
sed -i -e 's/! test -s/test_must_be_empty/' t[0-9]*.sh
with the following notable exceptions:
- The '! test -s' check in '.gitmodules ignore=dirty suppresses
submodules with untracked content' in 't7508-status.sh' is left
as-is, because it's bogus and, therefore, it's subject of a
dedicated patch.
- The '! test -s' checks in 't9131-git-svn-empty-symlink.sh' and
't9135-git-svn-moved-branch-empty-file.sh' are immediately
preceeded by a 'test -f' to ensure that the files exist in the
first place. 'test_must_be_empty' ensures that as well, so those
'test -f' commands are removed as well.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1501-work-tree.sh')
-rwxr-xr-x | t/t1501-work-tree.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh index afcdfafe45..3498d3d55e 100755 --- a/t/t1501-work-tree.sh +++ b/t/t1501-work-tree.sh @@ -41,7 +41,7 @@ test_expect_success 'setup: helper for testing rev-parse' ' # rev-parse --show-prefix should output # a single newline when at the top of the work tree, # but we test for that separately. - test -z "$4" && ! test -s actual.prefix || + test -z "$4" && test_must_be_empty actual.prefix || test_cmp expected.prefix actual.prefix fi } |