From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Sixt <j6t@kdbg.org>,
Don Slutz <Don.Slutz@SierraAtlantic.com>,
Jeff King <peff@peff.net>
Subject: [PATCH 1/3] test-lib: tests can have multiple prerequisites
Date: Wed, 21 Apr 2010 08:38:06 -0500 [thread overview]
Message-ID: <20100421133806.GA5595@progeny.tock> (raw)
In-Reply-To: <20100421131255.GA2750@progeny.tock>
Treat the prereq argument to test_expect_success and
test_expect_failure as a space-separated list of prerequisites.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Alas, I didn’t notice the thread with the almost identical patch [1]
before writing this one.
Since I am painting it, I prefer this way. I find it intuitive and
can’t really see where the fuss about using some other coding style
came from. So I would be very happy if someone who does understand
the fuss could come up with a comment to add to the commit message
about this. :)
t/test-lib.sh | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index c582964..a53b6cf 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -315,12 +315,15 @@ test_set_prereq () {
satisfied=" "
test_have_prereq () {
- case $satisfied in
- *" $1 "*)
- : yes, have it ;;
- *)
- ! : nope ;;
- esac
+ for prereq_to_test
+ do
+ case $satisfied in
+ *" $prereq_to_test "*)
+ : yes, have it ;;
+ *)
+ return 1 ;;
+ esac
+ done
}
# You are not expected to call test_ok_ and test_failure_ directly, use
@@ -370,7 +373,7 @@ test_skip () {
esac
done
if test -z "$to_skip" && test -n "$prereq" &&
- ! test_have_prereq "$prereq"
+ ! test_have_prereq $prereq
then
to_skip=t
fi
--
1.7.1.rc1
next prev parent reply other threads:[~2010-04-21 13:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-21 13:12 [PATCH 0/3] running tests as fakeroot Jonathan Nieder
2010-04-21 13:38 ` Jonathan Nieder [this message]
2010-04-21 14:57 ` [PATCH 1/3] test-lib: tests can have multiple prerequisites Jonathan Nieder
2010-04-26 19:17 ` Jeff King
2010-04-27 0:06 ` Junio C Hamano
2010-04-27 1:25 ` Jeff King
2010-04-21 13:44 ` [PATCH 2/3] t1004 (read-tree): the unremovable symlink test requires POSIXPERM Jonathan Nieder
2010-04-21 14:20 ` [PATCH 3/3] Permit tests to be run as a (fake) root user Jonathan Nieder
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=20100421133806.GA5595@progeny.tock \
--to=jrnieder@gmail.com \
--cc=Don.Slutz@SierraAtlantic.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--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).