diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-11-17 15:01:00 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-17 15:01:00 -0800 |
commit | 0510480510b181216d565ebcedea471d50c200b1 (patch) | |
tree | bf7beeb2fc8eca0e3692aedd15d9589b3de8ea86 /t/test-lib.sh | |
parent | ba0254cb32537b7a7e92854a51256475ee83cdda (diff) | |
parent | d7c411b71d727600d2f031fec9723873ae93c1c7 (diff) | |
download | git-0510480510b181216d565ebcedea471d50c200b1.tar.gz git-0510480510b181216d565ebcedea471d50c200b1.tar.xz |
Merge branch 'jk/push-progress'
* jk/push-progress:
push: pass --progress down to git-pack-objects
t5523-push-upstream: test progress messages
t5523-push-upstream: add function to ensure fresh upstream repo
test_terminal: ensure redirections work reliably
test_terminal: catch use without TTY prerequisite
test-lib: allow test code to check the list of declared prerequisites
tests: test terminal output to both stdout and stderr
tests: factor out terminal handling from t7006
Diffstat (limited to 't/test-lib.sh')
-rw-r--r-- | t/test-lib.sh | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index bbe79e0fc..744f4364c 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -366,6 +366,15 @@ test_have_prereq () { test $total_prereq = $ok_prereq } +test_declared_prereq () { + case ",$test_prereq," in + *,$1,*) + return 0 + ;; + esac + return 1 +} + # You are not expected to call test_ok_ and test_failure_ directly, use # the text_expect_* functions instead. @@ -418,17 +427,17 @@ test_skip () { break esac done - if test -z "$to_skip" && test -n "$prereq" && - ! test_have_prereq "$prereq" + if test -z "$to_skip" && test -n "$test_prereq" && + ! test_have_prereq "$test_prereq" then to_skip=t fi case "$to_skip" in t) of_prereq= - if test "$missing_prereq" != "$prereq" + if test "$missing_prereq" != "$test_prereq" then - of_prereq=" of $prereq" + of_prereq=" of $test_prereq" fi say_color skip >&3 "skipping test: $@" @@ -442,9 +451,10 @@ test_skip () { } test_expect_failure () { - test "$#" = 3 && { prereq=$1; shift; } || prereq= + test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq= test "$#" = 2 || error "bug in the test script: not 2 or 3 parameters to test-expect-failure" + export test_prereq if ! test_skip "$@" then say >&3 "checking known breakage: $2" @@ -460,9 +470,10 @@ test_expect_failure () { } test_expect_success () { - test "$#" = 3 && { prereq=$1; shift; } || prereq= + test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq= test "$#" = 2 || error "bug in the test script: not 2 or 3 parameters to test-expect-success" + export test_prereq if ! test_skip "$@" then say >&3 "expecting success: $2" @@ -504,11 +515,12 @@ test_expect_code () { # Usage: test_external description command arguments... # Example: test_external 'Perl API' perl ../path/to/test.pl test_external () { - test "$#" = 4 && { prereq=$1; shift; } || prereq= + test "$#" = 4 && { test_prereq=$1; shift; } || test_prereq= test "$#" = 3 || error >&5 "bug in the test script: not 3 or 4 parameters to test_external" descr="$1" shift + export test_prereq if ! test_skip "$descr" "$@" then # Announce the script to reduce confusion about the |