Skip to content
Snippets Groups Projects
Commit f0dc593a authored by SZEDER Gábor's avatar SZEDER Gábor Committed by Junio C Hamano
Browse files

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: default avatarSZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent ec10b018
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -192,7 +192,7 @@ test_expect_success 'shortlog with revision pseudo options' '
 
test_expect_success 'shortlog with --output=<file>' '
git shortlog --output=shortlog -1 master >output &&
test ! -s output &&
test_must_be_empty output &&
test_line_count = 3 shortlog
'
 
Loading
Loading
Loading
Loading
@@ -102,7 +102,7 @@ test_expect_success '-L with --first-parent and a merge' '
test_expect_success '-L with --output' '
git checkout parallel-change &&
git log --output=log -L :main:b.c >output &&
test ! -s output &&
test_must_be_empty output &&
test_line_count = 70 log
'
 
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ test_expect_success 'cat-file --textconv --path=<path> works' '
test_expect_success '--path=<path> complains without --textconv/--filters' '
sha1=$(git rev-parse -q --verify HEAD:world.txt) &&
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
'
 
Loading
Loading
Loading
Loading
@@ -310,7 +310,7 @@ test_expect_success SYMLINKS 'empty symlink target' '
# p4 to sync here will make it generate errors.
cd "$cli" &&
p4 print -q //depot/empty-symlink#2 >out &&
test ! -s out
test_must_be_empty out
) &&
test_when_finished cleanup_git &&
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment