summaryrefslogtreecommitdiff
path: root/t/t0000-basic.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2010-08-06 21:19:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-18 19:42:04 (GMT)
commit93a5724613861e6cd85964c85f2fa0891caab258 (patch)
tree33a0e1d47bb638b277ac91a3e9b370f92506aad7 /t/t0000-basic.sh
parent8ef1abe5504acb22f6a3fd24a0fda8c4b9f172a5 (diff)
downloadgit-93a5724613861e6cd85964c85f2fa0891caab258.zip
git-93a5724613861e6cd85964c85f2fa0891caab258.tar.gz
git-93a5724613861e6cd85964c85f2fa0891caab258.tar.bz2
test-lib: Add support for multiple test prerequisites
Change the test_have_prereq function in test-lib.sh to support a comma-separated list of prerequisites. This is useful for tests that need e.g. both POSIXPERM and SANITY. The implementation was stolen from Junio C Hamano and Johannes Sixt, the tests and documentation were not. See the "Tests in Cygwin" thread in May 2009 for the originals: http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385 http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118434 Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0000-basic.sh')
-rwxr-xr-xt/t0000-basic.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index f2c7336..2887677 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -73,6 +73,23 @@ then
exit 1
fi
+test_set_prereq HAVETHIS
+haveit=no
+test_expect_success HAVETHIS,HAVEIT 'test runs if prerequisites are satisfied' '
+ test_have_prereq HAVEIT &&
+ test_have_prereq HAVETHIS &&
+ haveit=yes
+'
+donthaveit=yes
+test_expect_success HAVEIT,DONTHAVEIT 'unmet prerequisites causes test to be skipped' '
+ donthaveit=no
+'
+if test $haveit$donthaveit != yesyes
+then
+ say "bug in test framework: multiple prerequisite tags do not work reliably"
+ exit 1
+fi
+
clean=no
test_expect_success 'tests clean up after themselves' '
test_when_finished clean=yes