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 not
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 basically created by:

  sed -i -e 's/! test -s/test_must_be_empty/' t[0-9]*.sh

with the following notable exceptions:

  - The '! test -s' check in '.gitmodules ignore=dirty suppresses
    submodules with untracked content' in 't7508-status.sh' is left
    as-is, because it's bogus and, therefore, it's subject of a
    dedicated patch.

  - The '! test -s' checks in 't9131-git-svn-empty-symlink.sh' and
    't9135-git-svn-moved-branch-empty-file.sh' are immediately
    preceeded by a 'test -f' to ensure that the files exist in the
    first place.  'test_must_be_empty' ensures that as well, so those
    'test -f' commands are removed as well.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index af61d08..4e588ed 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -116,7 +116,7 @@
 	name="$1" # stdin is the expected output from the test
 	(
 		cd "$name" &&
-		! test -s err &&
+		test_must_be_empty err &&
 		sed -e 's/^> //' -e 's/Z$//' >expect &&
 		test_cmp expect out
 	)
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 0c61268..9e88a56 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -239,7 +239,7 @@
 	>newdir/one &&
 	git add newdir/one &&
 	git checkout 2>errors &&
-	! test -s errors
+	test_must_be_empty errors
 '
 
 test_expect_success 'switching trees does not invalidate shared index' '
diff --git a/t/t0203-gettext-setlocale-sanity.sh b/t/t0203-gettext-setlocale-sanity.sh
index 71b0d74..0ce1f22 100755
--- a/t/t0203-gettext-setlocale-sanity.sh
+++ b/t/t0203-gettext-setlocale-sanity.sh
@@ -11,7 +11,7 @@
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 	test_commit "iso-c-commit" iso-under-c &&
 	git show >out 2>err &&
-	! test -s err &&
+	test_must_be_empty err &&
 	grep -q "iso-c-commit" out
 '
 
@@ -19,7 +19,7 @@
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 	test_commit "iso-utf8-commit" iso-under-utf8 &&
 	LANGUAGE=is LC_ALL="$is_IS_locale" git show >out 2>err &&
-	! test -s err &&
+	test_must_be_empty err &&
 	grep -q "iso-utf8-commit" out
 '
 
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index afcdfaf..3498d3d 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -41,7 +41,7 @@
 			# rev-parse --show-prefix should output
 			# a single newline when at the top of the work tree,
 			# but we test for that separately.
-			test -z "$4" && ! test -s actual.prefix ||
+			test -z "$4" && test_must_be_empty actual.prefix ||
 			test_cmp expected.prefix actual.prefix
 		fi
 	}
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 972bd9c..9974457 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -234,14 +234,14 @@
 	try_repo 0 unset unset unset "" unset \
 		.git "$here/0" "$here/0" "(null)" \
 		.git "$here/0" "$here/0" sub/ 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is accepted' '
 	try_repo 1 "$here" unset unset "" unset \
 		"$here/1/.git" "$here" "$here" 1/ \
 		"$here/1/.git" "$here" "$here" 1/sub/ 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#2: worktree defaults to cwd with explicit GIT_DIR' '
@@ -268,7 +268,7 @@
 	try_case 4 unset unset \
 		.git "$here/4/sub" "$here/4" "(null)" \
 		"$here/4/.git" "$here/4/sub" "$here/4/sub" "(null)" 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#5: core.worktree + GIT_WORK_TREE is accepted' '
@@ -279,7 +279,7 @@
 	try_repo 5a .. unset "$here/5a" "" unset \
 		"$here/5a/.git" "$here" "$here" 5a/ \
 		"$here/5a/.git" "$here/5a" "$here/5a" sub/ &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#6: setting GIT_DIR brings core.worktree to life' '
@@ -376,7 +376,7 @@
 	try_repo 9 wt unset unset gitfile unset \
 		"$here/9.git" "$here/9/wt" "$here/9" "(null)" \
 		"$here/9.git" "$here/9/sub/wt" "$here/9/sub" "(null)" 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#10: GIT_DIR can point to gitfile' '
@@ -402,7 +402,7 @@
 	try_repo 12 unset unset "$here/12" gitfile unset \
 		"$here/12.git" "$here/12" "$here/12" "(null)" \
 		"$here/12.git" "$here/12" "$here/12" sub/ 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#13: core.worktree+GIT_WORK_TREE accepted (with gitfile)' '
@@ -410,7 +410,7 @@
 	try_repo 13 non-existent-too unset non-existent gitfile unset \
 		"$here/13.git" "$here/13/non-existent-too" "$here/13" "(null)" \
 		"$here/13.git" "$here/13/sub/non-existent-too" "$here/13/sub" "(null)" 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 # case #14.
@@ -565,7 +565,7 @@
 	try_repo 17c "$here/17c" unset unset "" true \
 		.git "$here/17c" "$here/17c" "(null)" \
 		"$here/17c/.git" "$here/17c" "$here/17c" sub/ 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#18: bare .git named by GIT_DIR has no worktree' '
@@ -594,7 +594,7 @@
 		"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/ &&
 	try_case 20a/.git/wt/sub unset unset \
 		"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/sub/ &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#20b/c: core.worktree and core.bare conflict' '
@@ -626,7 +626,7 @@
 		export GIT_WORK_TREE &&
 		git status >/dev/null
 	) 2>message &&
-	! test -s message
+	test_must_be_empty message
 
 '
 run_wt_tests 21
@@ -742,7 +742,7 @@
 	try_repo 25 "$here/25" unset unset gitfile true \
 		"$here/25.git" "$here/25" "$here/25" "(null)"  \
 		"$here/25.git" "$here/25" "$here/25" "sub/" 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 
 test_expect_success '#26: bare repo has no worktree (GIT_DIR -> gitfile case)' '
@@ -780,7 +780,7 @@
 		export GIT_WORK_TREE &&
 		git status
 	) 2>message &&
-	! test -s message
+	test_must_be_empty message
 '
 run_wt_tests 29 gitfile
 
diff --git a/t/t2013-checkout-submodule.sh b/t/t2013-checkout-submodule.sh
index 6ef1573..8f86b5f 100755
--- a/t/t2013-checkout-submodule.sh
+++ b/t/t2013-checkout-submodule.sh
@@ -44,7 +44,7 @@
 	git config diff.ignoreSubmodules dirty &&
 	echo x> submodule/untracked &&
 	git checkout HEAD >actual 2>&1 &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
@@ -52,7 +52,7 @@
 	git config -f .gitmodules submodule.submodule.path submodule &&
 	git config -f .gitmodules submodule.submodule.ignore untracked &&
 	git checkout HEAD >actual 2>&1 &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/config' '
@@ -60,7 +60,7 @@
 	git config submodule.submodule.path submodule &&
 	git config submodule.submodule.ignore all &&
 	git checkout HEAD >actual 2>&1 &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
diff --git a/t/t2204-add-ignored.sh b/t/t2204-add-ignored.sh
index 8340ac2..2e07365 100755
--- a/t/t2204-add-ignored.sh
+++ b/t/t2204-add-ignored.sh
@@ -31,7 +31,7 @@
 		rm -f .git/index &&
 		test_must_fail git add "$i" 2>err &&
 		git ls-files "$i" >out &&
-		! test -s out
+		test_must_be_empty out
 	'
 
 	test_expect_success "complaints for ignored $i output" '
@@ -42,7 +42,7 @@
 		rm -f .git/index &&
 		test_must_fail git add "$i" file 2>err &&
 		git ls-files "$i" >out &&
-		! test -s out
+		test_must_be_empty out
 	'
 	test_expect_success "complaints for ignored $i with unignored file output" '
 		test_i18ngrep -e "Use -f if" err
@@ -57,7 +57,7 @@
 			cd dir &&
 			test_must_fail git add "$i" 2>err &&
 			git ls-files "$i" >out &&
-			! test -s out
+			test_must_be_empty out
 		)
 	'
 
@@ -77,7 +77,7 @@
 			cd sub &&
 			test_must_fail git add "$i" 2>err &&
 			git ls-files "$i" >out &&
-			! test -s out
+			test_must_be_empty out
 		)
 	'
 
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index b8fbdef..b178a37 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -382,7 +382,7 @@
 	git submodule update &&
 	git rm .gitmodules &&
 	git rm submod >actual 2>actual.err &&
-	! test -s actual.err &&
+	test_must_be_empty actual.err &&
 	! test -d submod &&
 	! test -f submod/.git &&
 	git status -s -uno >actual &&
@@ -400,7 +400,7 @@
 	git diff-files --quiet -- submod &&
 	git add .gitmodules &&
 	git rm submod >actual 2>actual.err &&
-	! test -s actual.err &&
+	test_must_be_empty actual.err &&
 	! test -d submod &&
 	! test -f submod/.git &&
 	git status -s -uno >actual &&
@@ -694,7 +694,7 @@
 	test_cmp expected actual &&
 	rm -rf submod &&
 	git status -s -uno --ignore-submodules=none >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'rm of d/f when d has become a non-directory' '
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index 108c012..5ae19b9 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -126,7 +126,7 @@
 	ln -s take\ over brain &&
 	test_must_fail git diff --no-index pinky brain >output 2>output.err &&
 	grep narf output &&
-	! test -s output.err
+	test_must_be_empty output.err
 '
 
 test_expect_success SYMLINKS 'setup symlinks with attributes' '
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index a501975..c6135c7 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -260,7 +260,7 @@
 
 	echo "F -whitespace" >.gitattributes &&
 	git diff --check >output &&
-	! test -s output
+	test_must_be_empty output
 
 '
 
diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh
index 6304130..e5f9eb7 100755
--- a/t/t4027-diff-submodule.sh
+++ b/t/t4027-diff-submodule.sh
@@ -104,19 +104,19 @@
 	expect_from_to >expect.body $subprev $subprev-dirty &&
 	test_cmp expect.body actual.body &&
 	git diff --ignore-submodules HEAD >actual2 &&
-	! test -s actual2 &&
+	test_must_be_empty actual2 &&
 	git diff --ignore-submodules=untracked HEAD >actual3 &&
 	sed -e "1,/^@@/d" actual3 >actual3.body &&
 	expect_from_to >expect.body $subprev $subprev-dirty &&
 	test_cmp expect.body actual3.body &&
 	git diff --ignore-submodules=dirty HEAD >actual4 &&
-	! test -s actual4
+	test_must_be_empty actual4
 '
 
 test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]' '
 	git config diff.ignoreSubmodules dirty &&
 	git diff HEAD >actual &&
-	! test -s actual &&
+	test_must_be_empty actual &&
 	git config --add -f .gitmodules submodule.subname.ignore none &&
 	git config --add -f .gitmodules submodule.subname.path sub &&
 	git diff HEAD >actual &&
@@ -126,7 +126,7 @@
 	git config -f .gitmodules submodule.subname.ignore all &&
 	git config -f .gitmodules submodule.subname.path sub &&
 	git diff HEAD >actual2 &&
-	! test -s actual2 &&
+	test_must_be_empty actual2 &&
 	git config -f .gitmodules submodule.subname.ignore untracked &&
 	git diff HEAD >actual3 &&
 	sed -e "1,/^@@/d" actual3 >actual3.body &&
@@ -134,7 +134,7 @@
 	test_cmp expect.body actual3.body &&
 	git config -f .gitmodules submodule.subname.ignore dirty &&
 	git diff HEAD >actual4 &&
-	! test -s actual4 &&
+	test_must_be_empty actual4 &&
 	git config submodule.subname.ignore none &&
 	git config submodule.subname.path sub &&
 	git diff HEAD >actual &&
@@ -172,24 +172,24 @@
 	expect_from_to >expect.body $subprev $subprev-dirty &&
 	test_cmp expect.body actual.body &&
 	git diff --ignore-submodules=all HEAD >actual2 &&
-	! test -s actual2 &&
+	test_must_be_empty actual2 &&
 	git diff --ignore-submodules=untracked HEAD >actual3 &&
-	! test -s actual3 &&
+	test_must_be_empty actual3 &&
 	git diff --ignore-submodules=dirty HEAD >actual4 &&
-	! test -s actual4
+	test_must_be_empty actual4
 '
 
 test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.gitmodules]' '
 	git config --add -f .gitmodules submodule.subname.ignore all &&
 	git config --add -f .gitmodules submodule.subname.path sub &&
 	git diff HEAD >actual2 &&
-	! test -s actual2 &&
+	test_must_be_empty actual2 &&
 	git config -f .gitmodules submodule.subname.ignore untracked &&
 	git diff HEAD >actual3 &&
-	! test -s actual3 &&
+	test_must_be_empty actual3 &&
 	git config -f .gitmodules submodule.subname.ignore dirty &&
 	git diff HEAD >actual4 &&
-	! test -s actual4 &&
+	test_must_be_empty actual4 &&
 	git config submodule.subname.ignore none &&
 	git config submodule.subname.path sub &&
 	git diff HEAD >actual &&
@@ -211,7 +211,7 @@
 	expect_from_to >expect.body $subtip $subprev &&
 	test_cmp expect.body actual.body &&
 	git diff --ignore-submodules HEAD^..HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'git diff between submodule commits [.gitmodules]' '
@@ -227,7 +227,7 @@
 	test_cmp expect.body actual.body &&
 	git config -f .gitmodules submodule.subname.ignore all &&
 	git diff HEAD^..HEAD >actual &&
-	! test -s actual &&
+	test_must_be_empty actual &&
 	git config submodule.subname.ignore dirty &&
 	git config submodule.subname.path sub &&
 	git diff  HEAD^..HEAD >actual &&
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 058ee08..302f216 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -273,17 +273,17 @@
 
 test_expect_success 'submodule contains untracked content (untracked ignored)' '
 	git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked content (dirty ignored)' '
 	git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked content (all ignored)' '
 	git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked and modifed content' '
@@ -308,13 +308,13 @@
 test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' '
 	echo new > sm1/foo6 &&
 	git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked and modifed content (all ignored)' '
 	echo new > sm1/foo6 &&
 	git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains modifed content' '
@@ -368,7 +368,7 @@
 
 test_expect_success 'modified submodule contains untracked content (all ignored)' '
 	git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'modified submodule contains untracked and modifed content' '
@@ -407,7 +407,7 @@
 test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' '
 	echo modification >> sm1/foo6 &&
 	git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'modified submodule contains modifed content' '
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index 4b168d0..6fc3da8 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -408,17 +408,17 @@
 
 test_expect_success 'submodule contains untracked content (untracked ignored)' '
 	git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked content (dirty ignored)' '
 	git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked content (all ignored)' '
 	git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked and modified content' '
@@ -458,13 +458,13 @@
 test_expect_success 'submodule contains untracked and modified content (dirty ignored)' '
 	echo new > sm1/foo6 &&
 	git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains untracked and modified content (all ignored)' '
 	echo new > sm1/foo6 &&
 	git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'submodule contains modified content' '
@@ -549,7 +549,7 @@
 
 test_expect_success 'modified submodule contains untracked content (all ignored)' '
 	git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'modified submodule contains untracked and modified content' '
@@ -609,7 +609,7 @@
 test_expect_success 'modified submodule contains untracked and modified content (all ignored)' '
 	echo modification >> sm1/foo6 &&
 	git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 # NOT OK
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index 4fc27c5..7e32237 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -100,7 +100,7 @@
 test_expect_success 'whitespace=error-all, default rule' '
 
 	test_must_fail apply_patch --whitespace=error-all &&
-	! test -s target
+	test_must_be_empty target
 
 '
 
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 1ebc587..38fe717 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -651,7 +651,7 @@
 	git checkout -f lorem2 &&
 	git reset base3way --hard &&
 	git am -3 -q lorem-move.patch >output.out 2>&1 &&
-	! test -s output.out
+	test_must_be_empty output.out
 '
 
 test_expect_success 'am pauses on conflict' '
@@ -874,7 +874,7 @@
 	git checkout first &&
 	test_tick &&
 	git am -q <patch1 >output.out 2>&1 &&
-	! test -s output.out
+	test_must_be_empty output.out
 '
 
 test_expect_success 'am empty-file does not infloop' '
diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
index 7f278d8c..ce151e7 100755
--- a/t/t5401-update-hooks.sh
+++ b/t/t5401-update-hooks.sh
@@ -104,17 +104,17 @@
 '
 
 test_expect_success 'all hook stdin is /dev/null' '
-	! test -s victim.git/update.stdin &&
-	! test -s victim.git/post-update.stdin
+	test_must_be_empty victim.git/update.stdin &&
+	test_must_be_empty victim.git/post-update.stdin
 '
 
 test_expect_success 'all *-receive hook args are empty' '
-	! test -s victim.git/pre-receive.args &&
-	! test -s victim.git/post-receive.args
+	test_must_be_empty victim.git/pre-receive.args &&
+	test_must_be_empty victim.git/post-receive.args
 '
 
 test_expect_success 'send-pack produced no output' '
-	! test -s send.out
+	test_must_be_empty send.out
 '
 
 cat <<EOF >expect
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 3d33ab3..07fcea0 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -161,7 +161,7 @@
 test_expect_success 'clone shallow object count (part 2)' '
 	sed -e "/^in-pack:/d" -e "/^packs:/d" -e "/^size-pack:/d" \
 	    -e "/: 0$/d" count.shallow > count_output &&
-	! test -s count_output
+	test_must_be_empty count_output
 '
 
 test_expect_success 'fsck in shallow repo' '
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 359e03f..ce3af92 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -98,8 +98,8 @@
 		cd downstream &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
@@ -107,8 +107,8 @@
 		cd downstream &&
 		git fetch --no-recurse-submodules >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
@@ -127,8 +127,8 @@
 		cd downstream &&
 		git fetch --no-recurse-submodules >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
@@ -137,8 +137,8 @@
 		git config submodule.submodule.fetchRecurseSubmodules false &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
@@ -157,8 +157,8 @@
 		cd downstream &&
 		git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "--quiet propagates to parallel submodules" '
@@ -166,8 +166,8 @@
 		cd downstream &&
 		git fetch --recurse-submodules -j 2 --quiet  >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "--dry-run propagates to submodules" '
@@ -221,8 +221,8 @@
 		git config fetch.recurseSubmodules true &&
 		git fetch --no-recurse-submodules >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "Recursion doesn't happen when no new commits are fetched in the superproject" '
@@ -235,8 +235,8 @@
 		git config --unset fetch.recurseSubmodules &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "Recursion stops when no new submodule commits are fetched" '
@@ -268,7 +268,7 @@
 		cd downstream &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
+	test_must_be_empty actual.out &&
 	test_i18ncmp expect.err.file actual.err
 '
 
@@ -357,8 +357,8 @@
 		git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
 		git config --unset fetch.recurseSubmodules
 	) &&
-	! test -s actual.out &&
-	! test -s actual.err
+	test_must_be_empty actual.out &&
+	test_must_be_empty actual.err
 '
 
 test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
@@ -402,7 +402,7 @@
 		cd downstream &&
 		git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
+	test_must_be_empty actual.out &&
 	test_i18ncmp expect.err.file actual.err
 '
 
@@ -477,7 +477,7 @@
 		cd downstream &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	! test -s actual.out &&
+	test_must_be_empty actual.out &&
 	test_i18ncmp expect.err actual.err &&
 	(
 		cd submodule &&
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index 0d4c520..12c1e43 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -51,7 +51,7 @@
 
 test_expect_success 'no-op fetch without "-v" is quiet' '
 	(cd clone && git fetch 2>../stderr) &&
-	! test -s stderr
+	test_must_be_empty stderr
 '
 
 test_expect_success 'remote detects correct HEAD' '
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index cc3fd2b..56ca467 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -384,7 +384,7 @@
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
-	! test -s actual.err &&
+	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
 	(
@@ -408,7 +408,7 @@
 	git diff-files --quiet -- sub &&
 	git add .gitmodules &&
 	git mv sub mod/sub 2>actual.err &&
-	! test -s actual.err &&
+	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
 	(
@@ -469,7 +469,7 @@
 	git update-index --refresh &&
 	git diff-files --quiet -- sub .gitmodules &&
 	git status -s sub2 >actual &&
-	! test -s actual
+	test_must_be_empty actual
 '
 
 test_expect_success 'mv -k does not accidentally destroy submodules' '
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index ab9da61..0e7d442 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -139,7 +139,7 @@
 	test_cmp expect uno &&
 	! test -f one &&
 	git diff --cached >current &&
-	! test -s current
+	test_must_be_empty current
 
 '
 
@@ -163,7 +163,7 @@
 	fill d2 aT d7 aS >expect &&
 	test_cmp current expect &&
 	git diff --cached two >current &&
-	! test -s current
+	test_must_be_empty current
 '
 
 test_expect_success 'format of merge conflict from checkout -m' '
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 9e0d317..0fef499 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -174,7 +174,7 @@
 	  git submodule update > ../actual 2> ../actual.err
 	) &&
 	test_i18ncmp expected actual &&
-	! test -s actual.err
+	test_must_be_empty actual.err
 '
 
 test_expect_success 'submodule update should fail due to local changes' '
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index fc44ec9..825da14 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -941,7 +941,7 @@
 	(
 		cd s || exit 1
 		( git grep xxyyzz .. >out ; echo $? >status )
-		! test -s out &&
+		test_must_be_empty out &&
 		test 1 = $(cat status)
 	)
 '
diff --git a/t/t9131-git-svn-empty-symlink.sh b/t/t9131-git-svn-empty-symlink.sh
index f762038..3bf4255 100755
--- a/t/t9131-git-svn-empty-symlink.sh
+++ b/t/t9131-git-svn-empty-symlink.sh
@@ -85,7 +85,7 @@
 test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" x'
 test_expect_success 'enable broken symlink workaround' \
   '(cd x && git config svn.brokenSymlinkWorkaround true)'
-test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
+test_expect_success '"bar" is an empty file' 'test_must_be_empty x/bar'
 test_expect_success 'get "bar" => symlink fix from svn' \
 		'(cd x && git svn rebase)'
 test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -h x/bar'
@@ -94,14 +94,14 @@
 test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'
 test_expect_success 'disable broken symlink workaround' \
   '(cd y && git config svn.brokenSymlinkWorkaround false)'
-test_expect_success '"bar" is an empty file' 'test -f y/bar && ! test -s y/bar'
+test_expect_success '"bar" is an empty file' 'test_must_be_empty y/bar'
 test_expect_success 'get "bar" => symlink fix from svn' \
 		'(cd y && git svn rebase)'
 test_expect_success '"bar" does not become a symlink' '! test -L y/bar'
 
 # svn.brokenSymlinkWorkaround is unset
 test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" z'
-test_expect_success '"bar" is an empty file' 'test -f z/bar && ! test -s z/bar'
+test_expect_success '"bar" is an empty file' 'test_must_be_empty z/bar'
 test_expect_success 'get "bar" => symlink fix from svn' \
 		'(cd z && git svn rebase)'
 test_expect_success '"bar" does not become a symlink' '! test -L z/bar'
diff --git a/t/t9135-git-svn-moved-branch-empty-file.sh b/t/t9135-git-svn-moved-branch-empty-file.sh
index 93db45d..2f80b21 100755
--- a/t/t9135-git-svn-moved-branch-empty-file.sh
+++ b/t/t9135-git-svn-moved-branch-empty-file.sh
@@ -13,8 +13,7 @@
 	(
 		cd x &&
 		git reset --hard origin/branch-c &&
-		test -f b1 &&
-		! test -s b1
+		test_must_be_empty b1
 	)
 	'