From: Junio C Hamano Date: Tue, 19 May 2015 20:17:55 +0000 (-0700) Subject: Merge branch 'jc/test-prereq-validate' X-Git-Tag: v2.5.0-rc0~109 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/072f391c53cb6845777f01db03d9b06c33ac87e3?ds=inline;hp=-c Merge branch 'jc/test-prereq-validate' Help us to find broken test script that splits the body part of the test by mistaken use of wrong kind of quotes. * jc/test-prereq-validate: test: validate prerequistes syntax --- 072f391c53cb6845777f01db03d9b06c33ac87e3 diff --combined t/test-lib-functions.sh index 8f8858a5f0,2c47d82003..e8d3c0fdbc --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@@ -348,11 -348,18 +348,18 @@@ test_declared_prereq () return 1 } + test_verify_prereq () { + test -z "$test_prereq" || + expr >/dev/null "$test_prereq" : '[A-Z0-9_,!]*$' || + error "bug in the test script: '$test_prereq' does not look like a prereq" + } + test_expect_failure () { test_start_ 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" + test_verify_prereq export test_prereq if ! test_skip "$@" then @@@ -372,6 -379,7 +379,7 @@@ test_expect_success () 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" + test_verify_prereq export test_prereq if ! test_skip "$@" then @@@ -400,6 -408,7 +408,7 @@@ test_external () error >&5 "bug in the test script: not 3 or 4 parameters to test_external" descr="$1" shift + test_verify_prereq export test_prereq if ! test_skip "$descr" "$@" then @@@ -478,7 -487,7 +487,7 @@@ test_external_without_stderr () test_path_is_file () { if ! test -f "$1" then - echo "File $1 doesn't exist. $*" + echo "File $1 doesn't exist. $2" false fi } @@@ -486,7 -495,7 +495,7 @@@ test_path_is_dir () { if ! test -d "$1" then - echo "Directory $1 doesn't exist. $*" + echo "Directory $1 doesn't exist. $2" false fi }