summaryrefslogtreecommitdiff
path: root/t/README
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2010-07-02 14:59:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-07-05 18:23:40 (GMT)
commit9a897893a76063a1fbe07f62ba78ab8f5308dbd3 (patch)
tree6e1622bda032f60f95e3d842de12480cfeb0c944 /t/README
parent85b0b34ea42628874198772fe6602365650ead88 (diff)
downloadgit-9a897893a76063a1fbe07f62ba78ab8f5308dbd3.zip
git-9a897893a76063a1fbe07f62ba78ab8f5308dbd3.tar.gz
git-9a897893a76063a1fbe07f62ba78ab8f5308dbd3.tar.bz2
t/README: Document the prereq functions, and 3-arg test_*
There was no documentation for the test_set_prereq and test_have_prereq functions, or the three-arg form of test_expect_success and test_expect_failure. 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/README37
1 files changed, 34 insertions, 3 deletions
diff --git a/t/README b/t/README
index a7312fa..c1fd092 100644
--- a/t/README
+++ b/t/README
@@ -246,9 +246,9 @@ Test harness library
There are a handful helper functions defined in the test harness
library for your script to use.
- - test_expect_success <message> <script>
+ - test_expect_success [<prereq>] <message> <script>
- This takes two strings as parameter, and evaluates the
+ Usually takes two strings as parameter, and evaluates the
<script>. If it yields success, test is considered
successful. <message> should state what it is testing.
@@ -258,7 +258,14 @@ library for your script to use.
'git-write-tree should be able to write an empty tree.' \
'tree=$(git-write-tree)'
- - test_expect_failure <message> <script>
+ If you supply three parameters the first will be taken to be a
+ prerequisite, see the test_set_prereq and test_have_prereq
+ documentation below:
+
+ test_expect_success TTY 'git --paginate rev-list uses a pager' \
+ ' ... '
+
+ - test_expect_failure [<prereq>] <message> <script>
This is NOT the opposite of test_expect_success, but is used
to mark a test that demonstrates a known breakage. Unlike
@@ -267,6 +274,9 @@ library for your script to use.
success and "still broken" on failure. Failures from these
tests won't cause -i (immediate) to stop.
+ Like test_expect_success this function can optionally use a three
+ argument invocation with a prerequisite as the first argument.
+
- test_debug <script>
This takes a single argument, <script>, and evaluates it only
@@ -299,6 +309,27 @@ library for your script to use.
Merges the given rev using the given message. Like test_commit,
creates a tag and calls test_tick before committing.
+ - test_set_prereq SOME_PREREQ
+
+ Set a test prerequisite to be used later with test_have_prereq. The
+ test-lib will set some prerequisites for you, e.g. PERL and PYTHON
+ which are derived from ./GIT-BUILD-OPTIONS (grep test_set_prereq
+ test-lib.sh for more). Others you can set yourself and use later
+ with either test_have_prereq directly, or the three argument
+ invocation of test_expect_success and test_expect_failure.
+
+ - test_have_prereq SOME PREREQ
+
+ Check if we have a prerequisite previously set with
+ test_set_prereq. The most common use of this directly is to skip
+ all the tests if we don't have some essential prerequisite:
+
+ if ! test_have_prereq PERL
+ then
+ skip_all='skipping perl interface tests, perl not available'
+ test_done
+ fi
+
Tips for Writing Tests
----------------------