test-lib: rearrange start/end of test_expect_* and test_skip

This moves * the early setup part from test_skip to a new function test_start_ * the final common parts of test_expect_* to a new function test_finish_ to make the next commit more obvious. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Rast committed Jun 18, 2013 at 14:25 UTC ae75342cff145a326b2213128cca453023521400
2 files changed +12 -3
t/test-lib-functions.sh
+4 -2
@@ -343,6 +343,7 @@ test_declared_prereq () {
343 }
344
345 test_expect_failure () {
346 + test_start_
347 test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
348 test "$#" = 2 ||
349 error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
@@ -357,10 +358,11 @@ test_expect_failure () {
358 test_known_broken_failure_ "$1"
359 fi
360 fi
360 - echo >&3 ""
361 + test_finish_
362 }
363
364 test_expect_success () {
365 + test_start_
366 test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
367 test "$#" = 2 ||
368 error "bug in the test script: not 2 or 3 parameters to test-expect-success"
@@ -375,7 +377,7 @@ test_expect_success () {
377 test_failure_ "$@"
378 fi
379 fi
378 - echo >&3 ""
380 + test_finish_
381 }
382
383 # test_external runs external test scripts that provide continuous
t/test-lib.sh
+8 -1
@@ -369,8 +369,15 @@ test_run_ () {
369 return "$eval_ret"
370 }
371
372 -test_skip () {
372 +test_start_ () {
373 test_count=$(($test_count+1))
374 +}
375 +
376 +test_finish_ () {
377 + echo >&3 ""
378 +}
379 +
380 +test_skip () {
381 to_skip=
382 if match_pattern_list $this_test.$test_count $GIT_SKIP_TESTS
383 then