Skip to content

Commit f0dc593

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec10b01 commit f0dc593

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

t/t4201-shortlog.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ test_expect_success 'shortlog with revision pseudo options' '
192192

193193
test_expect_success 'shortlog with --output=<file>' '
194194
git shortlog --output=shortlog -1 master >output &&
195-
test ! -s output &&
195+
test_must_be_empty output &&
196196
test_line_count = 3 shortlog
197197
'
198198

t/t4211-line-log.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ test_expect_success '-L with --first-parent and a merge' '
102102
test_expect_success '-L with --output' '
103103
git checkout parallel-change &&
104104
git log --output=log -L :main:b.c >output &&
105-
test ! -s output &&
105+
test_must_be_empty output &&
106106
test_line_count = 70 log
107107
'
108108

t/t8010-cat-file-filters.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test_expect_success 'cat-file --textconv --path=<path> works' '
4747
test_expect_success '--path=<path> complains without --textconv/--filters' '
4848
sha1=$(git rev-parse -q --verify HEAD:world.txt) &&
4949
test_must_fail git cat-file --path=hello.txt blob $sha1 >actual 2>err &&
50-
test ! -s actual &&
50+
test_must_be_empty actual &&
5151
grep "path.*needs.*filters" err
5252
'
5353

t/t9802-git-p4-filetype.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ test_expect_success SYMLINKS 'empty symlink target' '
310310
# p4 to sync here will make it generate errors.
311311
cd "$cli" &&
312312
p4 print -q //depot/empty-symlink#2 >out &&
313-
test ! -s out
313+
test_must_be_empty out
314314
) &&
315315
test_when_finished cleanup_git &&
316316

0 commit comments

Comments
 (0)