summaryrefslogtreecommitdiff
path: root/t/README
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2010-07-28 10:34:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-18 19:42:45 (GMT)
commit99d9050d256d1a928ce6d13fe275d8fd4bfcbdee (patch)
treecdc964e61b7002c54ab974bf051146fb36dd9419 /t/README
parent2c4f302607070c44b1bb1beca26ab4653a604baf (diff)
downloadgit-99d9050d256d1a928ce6d13fe275d8fd4bfcbdee.zip
git-99d9050d256d1a928ce6d13fe275d8fd4bfcbdee.tar.gz
git-99d9050d256d1a928ce6d13fe275d8fd4bfcbdee.tar.bz2
t/README: Update "Skipping tests" to align with best practices
The example I initially added to "Skipping tests" wasn't very good. We'd rather skip tests using the three-arg prereq form to the test_* functions, not bail out with a skip message. Change the documentation to reflect that, but retain the bailout example under a disclaimer which explains that it's probably not a good idea to use it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/README')
-rw-r--r--t/README21
1 files changed, 18 insertions, 3 deletions
diff --git a/t/README b/t/README
index e49534a..118e50d 100644
--- a/t/README
+++ b/t/README
@@ -319,9 +319,21 @@ Keep in mind:
Skipping tests
--------------
-If you need to skip all the remaining tests you should set skip_all
-and immediately call test_done. The string you give to skip_all will
-be used as an explanation for why the test was skipped. for instance:
+If you need to skip tests you should do so be using the three-arg form
+of the test_* functions (see the "Test harness library" section
+below), e.g.:
+
+ test_expect_success PERL 'I need Perl' "
+ '$PERL_PATH' -e 'hlagh() if unf_unf()'
+ "
+
+The advantage of skipping tests like this is that platforms that don't
+have the PERL and other optional dependencies get an indication of how
+many tests they're missing.
+
+If the test code is too hairy for that (i.e. does a lot of setup work
+outside test assertions) you can also skip all remaining tests by
+setting skip_all and immediately call test_done:
if ! test_have_prereq PERL
then
@@ -329,6 +341,9 @@ be used as an explanation for why the test was skipped. for instance:
test_done
fi
+The string you give to skip_all will be used as an explanation for why
+the test was skipped.
+
End with test_done
------------------