From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Olga Telezhnaya" <olyatelezhnaya@gmail.com>,
"Jeff King" <peff@peff.net>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 1/6] mktag tests: parse out options in helper
Date: Mon, 14 Jun 2021 19:28:18 +0200 [thread overview]
Message-ID: <patch-1.6-d49549973d3-20210614T172422Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-0.6-00000000000-20210614T172422Z-avarab@gmail.com>
Change check_verify_failure() helper to parse out options from
$@. This makes it easier to add new options in the future. See
06ce79152be (mktag: add a --[no-]strict option, 2021-01-06) for the
initial implementation.
Let's also replace "" quotes with '' for the test body, the varables
we need are eval'd into the body, so there's no need for the quoting
confusion.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
t/t3800-mktag.sh | 43 +++++++++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 12 deletions(-)
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index 6275c98523f..e9008744e3d 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -12,15 +12,29 @@ test_description='git mktag: tag object verify test'
# given in the expect.pat file.
check_verify_failure () {
- test_expect_success "$1" "
- test_must_fail git mktag <tag.sig 2>message &&
- grep '$2' message &&
- if test '$3' != '--no-strict'
+ subject=$1 &&
+ message=$2 &&
+ shift 2 &&
+
+ no_strict= &&
+ while test $# != 0
+ do
+ case "$1" in
+ --no-strict)
+ no_strict=yes
+ ;;
+ esac &&
+ shift
+ done &&
+
+ test_expect_success "fail with [--[no-]strict]: $subject" '
+ test_must_fail git mktag <tag.sig 2>err &&
+ if test -z "$no_strict"
then
- test_must_fail git mktag --no-strict <tag.sig 2>message.no-strict &&
- grep '$2' message.no-strict
+ test_must_fail git mktag <tag.sig 2>err2 &&
+ test_cmp err err2
fi
- "
+ '
}
test_expect_mktag_success() {
@@ -243,7 +257,8 @@ tagger . <> 0 +0000
EOF
check_verify_failure 'verify tag-name check' \
- '^error:.* badTagName:' '--no-strict'
+ '^error:.* badTagName:' \
+ --no-strict
############################################################
# 11. tagger line label check #1
@@ -257,7 +272,8 @@ This is filler
EOF
check_verify_failure '"tagger" line label check #1' \
- '^error:.* missingTaggerEntry:' '--no-strict'
+ '^error:.* missingTaggerEntry:' \
+ --no-strict
############################################################
# 12. tagger line label check #2
@@ -272,7 +288,8 @@ This is filler
EOF
check_verify_failure '"tagger" line label check #2' \
- '^error:.* missingTaggerEntry:' '--no-strict'
+ '^error:.* missingTaggerEntry:' \
+ --no-strict
############################################################
# 13. allow missing tag author name like fsck
@@ -301,7 +318,8 @@ tagger T A Gger <
EOF
check_verify_failure 'disallow malformed tagger' \
- '^error:.* badEmail:' '--no-strict'
+ '^error:.* badEmail:' \
+ --no-strict
############################################################
# 15. allow empty tag email
@@ -425,7 +443,8 @@ this line should not be here
EOF
check_verify_failure 'detect invalid header entry' \
- '^error:.* extraHeaderEntry:' '--no-strict'
+ '^error:.* extraHeaderEntry:' \
+ --no-strict
test_expect_success 'invalid header entry config & fsck' '
test_must_fail git mktag <tag.sig &&
--
2.32.0.555.g0268d380f7b
next prev parent reply other threads:[~2021-06-14 17:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 17:28 [PATCH 0/6] mktag tests: test more exhaustively Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` Ævar Arnfjörð Bjarmason [this message]
2021-06-14 17:28 ` [PATCH 2/6] mktag tests: invert --no-strict test Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 3/6] mktag tests: test hash-object --literally and unreachable fsck Ævar Arnfjörð Bjarmason
2021-06-15 10:34 ` Andrei Rybak
2021-06-15 14:41 ` Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 4/6] mktag tests: test update-ref and reachable fsck Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 5/6] mktag tests: test for-each-ref Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 6/6] mktag tests: test fast-export Ævar Arnfjörð Bjarmason
2021-06-15 3:06 ` [PATCH 0/6] mktag tests: test more exhaustively Junio C Hamano
2021-06-17 10:41 ` [PATCH v2 " Ævar Arnfjörð Bjarmason
2021-06-17 10:41 ` [PATCH v2 1/6] mktag tests: parse out options in helper Ævar Arnfjörð Bjarmason
2021-06-17 10:41 ` [PATCH v2 2/6] mktag tests: invert --no-strict test Ævar Arnfjörð Bjarmason
2021-06-17 10:41 ` [PATCH v2 3/6] mktag tests: test hash-object --literally and unreachable fsck Ævar Arnfjörð Bjarmason
2021-06-17 10:42 ` [PATCH v2 4/6] mktag tests: test update-ref and reachable fsck Ævar Arnfjörð Bjarmason
2021-06-17 10:42 ` [PATCH v2 5/6] mktag tests: test for-each-ref Ævar Arnfjörð Bjarmason
2021-06-17 10:42 ` [PATCH v2 6/6] mktag tests: test fast-export Ævar Arnfjörð Bjarmason
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=patch-1.6-d49549973d3-20210614T172422Z-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=olyatelezhnaya@gmail.com \
--cc=peff@peff.net \
/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).