]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: use 'test_must_be_empty' instead of 'test ! -s'
authorSZEDER Gábor <szeder.dev@gmail.com>
Sun, 19 Aug 2018 21:57:23 +0000 (23:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Aug 2018 18:48:31 +0000 (11:48 -0700)
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>
t/t4201-shortlog.sh
t/t4211-line-log.sh
t/t8010-cat-file-filters.sh
t/t9802-git-p4-filetype.sh

index 58c27736762dde372408a4dacfb030f0e1a55b99..d3a7ce6bbb2ca926d200f099d25d26570a3c1ce6 100755 (executable)
@@ -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
 '
 
index d0377fae5c832bcd4df37f3bc2ab4a8708f70251..6e378b23c797a83e2553594b00bec5b90b5aefe0 100755 (executable)
@@ -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
 '
 
index 0f86c191745d65c88c70881c6520685289bc2405..31de4b64dc06c1aad760dfc4ad585d11b46a65d8 100755 (executable)
@@ -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
 '
 
index 1fc9b33aeb5f095816fba72e85c94f0455994418..9978352d7828dbd63d44d172b91193a20291c4d1 100755 (executable)
@@ -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 &&