From f0dc593a95877298ba6fa9d29e5c779832ad5894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 19 Aug 2018 23:57:23 +0200 Subject: tests: use 'test_must_be_empty' instead of 'test ! -s' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh index 58c2773..d3a7ce6 100755 --- a/t/t4201-shortlog.sh +++ b/t/t4201-shortlog.sh @@ -192,7 +192,7 @@ test_expect_success 'shortlog with revision pseudo options' ' test_expect_success 'shortlog with --output=' ' git shortlog --output=shortlog -1 master >output && - test ! -s output && + test_must_be_empty output && test_line_count = 3 shortlog ' diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh index d0377fa..6e378b2 100755 --- a/t/t4211-line-log.sh +++ b/t/t4211-line-log.sh @@ -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 ' diff --git a/t/t8010-cat-file-filters.sh b/t/t8010-cat-file-filters.sh index 0f86c19..31de4b6 100755 --- a/t/t8010-cat-file-filters.sh +++ b/t/t8010-cat-file-filters.sh @@ -47,7 +47,7 @@ test_expect_success 'cat-file --textconv --path= works' ' test_expect_success '--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 ' diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh index 1fc9b33..9978352 100755 --- a/t/t9802-git-p4-filetype.sh +++ b/t/t9802-git-p4-filetype.sh @@ -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 && -- cgit v0.10.2-6-g49f6