Skip to content

Commit ae75342

Browse files
Thomas Rastgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e6a6ddc commit ae75342

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

t/test-lib-functions.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ test_declared_prereq () {
343343
}
344344

345345
test_expect_failure () {
346+
test_start_
346347
test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
347348
test "$#" = 2 ||
348349
error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
@@ -357,10 +358,11 @@ test_expect_failure () {
357358
test_known_broken_failure_ "$1"
358359
fi
359360
fi
360-
echo >&3 ""
361+
test_finish_
361362
}
362363

363364
test_expect_success () {
365+
test_start_
364366
test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
365367
test "$#" = 2 ||
366368
error "bug in the test script: not 2 or 3 parameters to test-expect-success"
@@ -375,7 +377,7 @@ test_expect_success () {
375377
test_failure_ "$@"
376378
fi
377379
fi
378-
echo >&3 ""
380+
test_finish_
379381
}
380382

381383
# test_external runs external test scripts that provide continuous

t/test-lib.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,15 @@ test_run_ () {
369369
return "$eval_ret"
370370
}
371371

372-
test_skip () {
372+
test_start_ () {
373373
test_count=$(($test_count+1))
374+
}
375+
376+
test_finish_ () {
377+
echo >&3 ""
378+
}
379+
380+
test_skip () {
374381
to_skip=
375382
if match_pattern_list $this_test.$test_count $GIT_SKIP_TESTS
376383
then

0 commit comments

Comments
 (0)