From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Andrei Rybak" <rybak.a.v@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: [PATCH 2/4] tests: use 'test_must_be_empty' instead of 'test ! -s'
Date: Sun, 19 Aug 2018 23:57:23 +0200 [thread overview]
Message-ID: <20180819215725.29001-3-szeder.dev@gmail.com> (raw)
In-Reply-To: <20180819215725.29001-1-szeder.dev@gmail.com>
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>
---
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
next prev parent reply other threads:[~2018-08-19 21:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-19 21:57 [PATCH 0/4] tests: make more use of 'test_must_be_empty' SZEDER Gábor
2018-08-19 21:57 ` [PATCH 1/4] tests: use 'test_must_be_empty' instead of '! test -s' SZEDER Gábor
2018-08-19 21:57 ` SZEDER Gábor [this message]
2018-08-19 21:57 ` [PATCH 3/4] tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null <out>' SZEDER Gábor
2018-08-19 21:57 ` [PATCH 4/4] tests: use 'test_must_be_empty' instead of 'test_cmp <empty> <out>' SZEDER Gábor
2018-08-22 17:52 ` [PATCH 0/4] tests: make more use of 'test_must_be_empty' Matthew DeVore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180819215725.29001-3-szeder.dev@gmail.com \
--to=szeder.dev@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rybak.a.v@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).