@@ -362,6 +362,15 @@ test_have_prereq () {
362
362
test $total_prereq = $ok_prereq
363
363
}
364
364
365
+ test_declared_prereq () {
366
+ case " ,$test_prereq ," in
367
+ * ,$1 ,* )
368
+ return 0
369
+ ;;
370
+ esac
371
+ return 1
372
+ }
373
+
365
374
# You are not expected to call test_ok_ and test_failure_ directly, use
366
375
# the text_expect_* functions instead.
367
376
@@ -414,17 +423,17 @@ test_skip () {
414
423
break
415
424
esac
416
425
done
417
- if test -z " $to_skip " && test -n " $prereq " &&
418
- ! test_have_prereq " $prereq "
426
+ if test -z " $to_skip " && test -n " $test_prereq " &&
427
+ ! test_have_prereq " $test_prereq "
419
428
then
420
429
to_skip=t
421
430
fi
422
431
case " $to_skip " in
423
432
t)
424
433
of_prereq=
425
- if test " $missing_prereq " ! = " $prereq "
434
+ if test " $missing_prereq " ! = " $test_prereq "
426
435
then
427
- of_prereq=" of $prereq "
436
+ of_prereq=" of $test_prereq "
428
437
fi
429
438
430
439
say_color skip >&3 " skipping test: $@ "
@@ -438,9 +447,10 @@ test_skip () {
438
447
}
439
448
440
449
test_expect_failure () {
441
- test " $# " = 3 && { prereq =$1 ; shift ; } || prereq =
450
+ test " $# " = 3 && { test_prereq =$1 ; shift ; } || test_prereq =
442
451
test " $# " = 2 ||
443
452
error " bug in the test script: not 2 or 3 parameters to test-expect-failure"
453
+ export test_prereq
444
454
if ! test_skip " $@ "
445
455
then
446
456
say >&3 " checking known breakage: $2 "
@@ -456,9 +466,10 @@ test_expect_failure () {
456
466
}
457
467
458
468
test_expect_success () {
459
- test " $# " = 3 && { prereq =$1 ; shift ; } || prereq =
469
+ test " $# " = 3 && { test_prereq =$1 ; shift ; } || test_prereq =
460
470
test " $# " = 2 ||
461
471
error " bug in the test script: not 2 or 3 parameters to test-expect-success"
472
+ export test_prereq
462
473
if ! test_skip " $@ "
463
474
then
464
475
say >&3 " expecting success: $2 "
@@ -500,11 +511,12 @@ test_expect_code () {
500
511
# Usage: test_external description command arguments...
501
512
# Example: test_external 'Perl API' perl ../path/to/test.pl
502
513
test_external () {
503
- test " $# " = 4 && { prereq =$1 ; shift ; } || prereq =
514
+ test " $# " = 4 && { test_prereq =$1 ; shift ; } || test_prereq =
504
515
test " $# " = 3 ||
505
516
error >&5 " bug in the test script: not 3 or 4 parameters to test_external"
506
517
descr=" $1 "
507
518
shift
519
+ export test_prereq
508
520
if ! test_skip " $descr " " $@ "
509
521
then
510
522
# Announce the script to reduce confusion about the
0 commit comments