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 no 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 created by: sed -i -e 's/test ! -s/test_must_be_empty/' t[0-9]*.sh Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Aug 19, 2018 at 23:57 UTC
f0dc593a95877298ba6fa9d29e5c779832ad5894
4 files changed
+4
-4
t/t4201-shortlog.sh
+1
-1
@@ -192,7 +192,7 @@ test_expect_success 'shortlog with revision pseudo options' '
192
193
test_expect_success 'shortlog with --output=<file>' '
194
git shortlog --output=shortlog -1 master >output &&
195
- test ! -s output &&
195
+ test_must_be_empty output &&
196
test_line_count = 3 shortlog
197
'
198
t/t4211-line-log.sh
+1
-1
@@ -102,7 +102,7 @@ test_expect_success '-L with --first-parent and a merge' '
102
test_expect_success '-L with --output' '
103
git checkout parallel-change &&
104
git log --output=log -L :main:b.c >output &&
105
- test ! -s output &&
105
+ test_must_be_empty output &&
106
test_line_count = 70 log
107
'
108
t/t8010-cat-file-filters.sh
+1
-1
@@ -47,7 +47,7 @@ test_expect_success 'cat-file --textconv --path=<path> works' '
47
test_expect_success '--path=<path> complains without --textconv/--filters' '
48
sha1=$(git rev-parse -q --verify HEAD:world.txt) &&
49
test_must_fail git cat-file --path=hello.txt blob $sha1 >actual 2>err &&
50
- test ! -s actual &&
50
+ test_must_be_empty actual &&
51
grep "path.*needs.*filters" err
52
'
53
t/t9802-git-p4-filetype.sh
+1
-1
@@ -310,7 +310,7 @@ test_expect_success SYMLINKS 'empty symlink target' '
310
# p4 to sync here will make it generate errors.
311
cd "$cli" &&
312
p4 print -q //depot/empty-symlink#2 >out &&
313
- test ! -s out
313
+ test_must_be_empty out
314
) &&
315
test_when_finished cleanup_git &&
316