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>
This commit is contained in:
SZEDER Gábor 2018-08-19 23:57:23 +02:00 committed by Junio C Hamano
parent ec10b018e7
commit f0dc593a95
4 changed files with 4 additions and 4 deletions

View File

@ -192,7 +192,7 @@ test_expect_success 'shortlog with revision pseudo options' '
test_expect_success 'shortlog with --output=<file>' ' test_expect_success 'shortlog with --output=<file>' '
git shortlog --output=shortlog -1 master >output && git shortlog --output=shortlog -1 master >output &&
test ! -s output && test_must_be_empty output &&
test_line_count = 3 shortlog test_line_count = 3 shortlog
' '

View File

@ -102,7 +102,7 @@ test_expect_success '-L with --first-parent and a merge' '
test_expect_success '-L with --output' ' test_expect_success '-L with --output' '
git checkout parallel-change && git checkout parallel-change &&
git log --output=log -L :main:b.c >output && git log --output=log -L :main:b.c >output &&
test ! -s output && test_must_be_empty output &&
test_line_count = 70 log test_line_count = 70 log
' '

View File

@ -47,7 +47,7 @@ test_expect_success 'cat-file --textconv --path=<path> works' '
test_expect_success '--path=<path> complains without --textconv/--filters' ' test_expect_success '--path=<path> complains without --textconv/--filters' '
sha1=$(git rev-parse -q --verify HEAD:world.txt) && sha1=$(git rev-parse -q --verify HEAD:world.txt) &&
test_must_fail git cat-file --path=hello.txt blob $sha1 >actual 2>err && test_must_fail git cat-file --path=hello.txt blob $sha1 >actual 2>err &&
test ! -s actual && test_must_be_empty actual &&
grep "path.*needs.*filters" err grep "path.*needs.*filters" err
' '

View File

@ -310,7 +310,7 @@ test_expect_success SYMLINKS 'empty symlink target' '
# p4 to sync here will make it generate errors. # p4 to sync here will make it generate errors.
cd "$cli" && cd "$cli" &&
p4 print -q //depot/empty-symlink#2 >out && p4 print -q //depot/empty-symlink#2 >out &&
test ! -s out test_must_be_empty out
) && ) &&
test_when_finished cleanup_git && test_when_finished cleanup_git &&