Subject: [PATCH 2/4] tests: use 'test_must_be_empty' instead of 'test ! -s'

From: SZEDER Gábor <[email-masked]>
Date: Sun, 19 Aug 2018 23:57:23 +0200

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-masked]>
---
 t/t4201-shortlog.sh         | 2 +-
 t/t4211-line-log.sh         | 2 +-
 t/t8010-cat-file-filters.sh | 2 +-
 t/t9802-git-p4-filetype.sh  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index 58c2773676..d3a7ce6bbb 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=<file>' '
 	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 d0377fae5c..6e378b23c7 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 0f86c19174..31de4b64dc 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=<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
 '
 
diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
index 1fc9b33aeb..9978352d78 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 &&
 
-- 
2.18.0.903.gab616d7dc6