10
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
12
# Make Test::Builder thread-safe for ithreads.
15
# Load threads::shared when threads are turned on.
16
# 5.8.0's threads are so busted we no longer support them.
17
if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
18
require threads::shared;
20
# Hack around YET ANOTHER threads::shared bug. It would
21
# occassionally forget the contents of the variable when sharing it.
22
# So we first copy the data, then share, then put our copy back.
23
*share = sub (\[$@%]) {
27
if( $type eq 'HASH' ) {
30
elsif( $type eq 'ARRAY' ) {
33
elsif( $type eq 'SCALAR' ) {
37
die( "Unknown type: " . $type );
40
$_[0] = &threads::shared::share( $_[0] );
42
if( $type eq 'HASH' ) {
45
elsif( $type eq 'ARRAY' ) {
48
elsif( $type eq 'SCALAR' ) {
52
die( "Unknown type: " . $type );
58
# 5.8.0's threads::shared is busted when threads are off
59
# and earlier Perls just don't have that module at all.
61
*share = sub { return $_[0] };
68
my $Test = Test::Builder->new;
72
$Test ||= $class->create;
81
my $self = bless {}, $class;
91
sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
94
# We leave this a global because it has to be localized and localizing
95
# hash keys is just asking for pain. Also, it was documented.
98
$self->{Have_Plan} = 0;
100
$self->{Original_Pid} = $$;
102
share( $self->{Curr_Test} );
103
$self->{Curr_Test} = 0;
104
$self->{Test_Results} = &share( [] );
106
$self->{Exported_To} = undef;
107
$self->{Expected_Tests} = 0;
109
$self->{Skip_All} = 0;
111
$self->{Use_Nums} = 1;
113
$self->{No_Header} = 0;
114
$self->{No_Ending} = 0;
116
$self->{Todo} = undef;
117
$self->{Todo_Stack} = [];
118
$self->{Start_Todo} = 0;
120
$self->_dup_stdhandles;
128
my( $self, $cmd, $arg ) = @_;
132
local $Level = $Level + 1;
134
$self->croak("You tried to plan twice")
135
if $self->{Have_Plan};
137
if( $cmd eq 'no_plan' ) {
138
$self->carp("no_plan takes no arguments") if $arg;
141
elsif( $cmd eq 'skip_all' ) {
142
return $self->skip_all($arg);
144
elsif( $cmd eq 'tests' ) {
146
local $Level = $Level + 1;
147
return $self->expected_tests($arg);
149
elsif( !defined $arg ) {
150
$self->croak("Got an undefined number of tests");
153
$self->croak("You said to run 0 tests");
157
my @args = grep { defined } ( $cmd, $arg );
158
$self->croak("plan() doesn't understand @args");
171
$self->croak("Number of tests must be a positive integer. You gave it '$max'")
172
unless $max =~ /^\+?\d+$/;
174
$self->{Expected_Tests} = $max;
175
$self->{Have_Plan} = 1;
177
$self->_print("1..$max\n") unless $self->no_header;
179
return $self->{Expected_Tests};
187
$self->{No_Plan} = 1;
188
$self->{Have_Plan} = 1;
198
return( $self->{Expected_Tests} ) if $self->{Expected_Tests};
199
return('no_plan') if $self->{No_Plan};
206
my( $self, $reason ) = @_;
209
$out .= " # Skip $reason" if $reason;
212
$self->{Skip_All} = 1;
214
$self->_print($out) unless $self->no_header;
221
my( $self, $pack ) = @_;
223
if( defined $pack ) {
224
$self->{Exported_To} = $pack;
226
return $self->{Exported_To};
232
my( $self, $test, $name ) = @_;
234
# $test might contain an object which we don't want to accidentally
235
# store, so we turn it into a boolean.
236
$test = $test ? 1 : 0;
240
lock $self->{Curr_Test};
241
$self->{Curr_Test}++;
243
# In case $name is a string overloaded object, force it to stringify.
244
$self->_unoverload_str( \$name );
246
$self->diag(<<"ERR") if defined $name and $name =~ /^[\d\s]+$/;
247
You named your test '$name'. You shouldn't use numbers for your test names.
251
# Capture the value of $TODO for the rest of this ok() call
252
# so it can more easily be found by other routines.
253
my $todo = $self->todo();
254
my $in_todo = $self->in_todo;
255
local $self->{Todo} = $todo if $in_todo;
257
$self->_unoverload_str( \$todo );
260
my $result = &share( {} );
264
@$result{ 'ok', 'actual_ok' } = ( ( $self->in_todo ? 1 : 0 ), 0 );
267
@$result{ 'ok', 'actual_ok' } = ( 1, $test );
271
$out .= " $self->{Curr_Test}" if $self->use_numbers;
273
if( defined $name ) {
274
$name =~ s|#|\\#|g; # # in a name can confuse Test::Harness.
276
$result->{name} = $name;
279
$result->{name} = '';
282
if( $self->in_todo ) {
283
$out .= " # TODO $todo";
284
$result->{reason} = $todo;
285
$result->{type} = 'todo';
288
$result->{reason} = '';
289
$result->{type} = '';
292
$self->{Test_Results}[ $self->{Curr_Test} - 1 ] = $result;
298
my $msg = $self->in_todo ? "Failed (TODO)" : "Failed";
299
$self->_print_to_fh( $self->_diag_fh, "\n" ) if $ENV{HARNESS_ACTIVE};
301
my( undef, $file, $line ) = $self->caller;
302
if( defined $name ) {
303
$self->diag(qq[ $msg test '$name'\n]);
304
$self->diag(qq[ at $file line $line.\n]);
307
$self->diag(qq[ $msg test at $file line $line.\n]);
311
return $test ? 1 : 0;
318
$self->_try(sub { require overload; }, die_on_fail => 1);
320
foreach my $thing (@_) {
321
if( $self->_is_object($$thing) ) {
322
if( my $string_meth = overload::Method( $$thing, $type ) ) {
323
$$thing = $$thing->$string_meth();
332
my( $self, $thing ) = @_;
334
return $self->_try( sub { ref $thing && $thing->isa('UNIVERSAL') } ) ? 1 : 0;
337
sub _unoverload_str {
340
return $self->_unoverload( q[""], @_ );
343
sub _unoverload_num {
346
$self->_unoverload( '0+', @_ );
349
next unless $self->_is_dualvar($$val);
356
# This is a hack to detect a dualvar such as $!
358
my( $self, $val ) = @_;
360
# Objects are not dualvars.
361
return 0 if ref $val;
363
no warnings 'numeric';
364
my $numval = $val + 0;
365
return $numval != 0 and $numval ne $val ? 1 : 0;
371
my( $self, $got, $expect, $name ) = @_;
372
local $Level = $Level + 1;
374
$self->_unoverload_str( \$got, \$expect );
376
if( !defined $got || !defined $expect ) {
377
# undef only matches undef and nothing else
378
my $test = !defined $got && !defined $expect;
380
$self->ok( $test, $name );
381
$self->_is_diag( $got, 'eq', $expect ) unless $test;
385
return $self->cmp_ok( $got, 'eq', $expect, $name );
389
my( $self, $got, $expect, $name ) = @_;
390
local $Level = $Level + 1;
392
$self->_unoverload_num( \$got, \$expect );
394
if( !defined $got || !defined $expect ) {
395
# undef only matches undef and nothing else
396
my $test = !defined $got && !defined $expect;
398
$self->ok( $test, $name );
399
$self->_is_diag( $got, '==', $expect ) unless $test;
403
return $self->cmp_ok( $got, '==', $expect, $name );
407
my( $self, $type, $val ) = @_;
409
if( defined $$val ) {
410
if( $type eq 'eq' or $type eq 'ne' ) {
411
# quote and force string context
415
# force numeric context
416
$self->_unoverload_num($val);
427
my( $self, $got, $type, $expect ) = @_;
429
$self->_diag_fmt( $type, $_ ) for \$got, \$expect;
431
local $Level = $Level + 1;
432
return $self->diag(<<"DIAGNOSTIC");
440
my( $self, $got, $type ) = @_;
442
$self->_diag_fmt( $type, \$got );
444
local $Level = $Level + 1;
445
return $self->diag(<<"DIAGNOSTIC");
447
expected: anything else
454
my( $self, $got, $dont_expect, $name ) = @_;
455
local $Level = $Level + 1;
457
if( !defined $got || !defined $dont_expect ) {
458
# undef only matches undef and nothing else
459
my $test = defined $got || defined $dont_expect;
461
$self->ok( $test, $name );
462
$self->_isnt_diag( $got, 'ne' ) unless $test;
466
return $self->cmp_ok( $got, 'ne', $dont_expect, $name );
470
my( $self, $got, $dont_expect, $name ) = @_;
471
local $Level = $Level + 1;
473
if( !defined $got || !defined $dont_expect ) {
474
# undef only matches undef and nothing else
475
my $test = defined $got || defined $dont_expect;
477
$self->ok( $test, $name );
478
$self->_isnt_diag( $got, '!=' ) unless $test;
482
return $self->cmp_ok( $got, '!=', $dont_expect, $name );
488
my( $self, $this, $regex, $name ) = @_;
490
local $Level = $Level + 1;
491
return $self->_regex_ok( $this, $regex, '=~', $name );
495
my( $self, $this, $regex, $name ) = @_;
497
local $Level = $Level + 1;
498
return $self->_regex_ok( $this, $regex, '!~', $name );
503
my %numeric_cmps = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" );
506
my( $self, $got, $type, $expect, $name ) = @_;
511
## no critic (BuiltinFunctions::ProhibitStringyEval)
513
local( $@, $!, $SIG{__DIE__} ); # isolate eval
515
my($pack, $file, $line) = $self->caller();
518
#line 1 "cmp_ok [from $file line $line]"
519
\$got $type \$expect;
523
local $Level = $Level + 1;
524
my $ok = $self->ok( $test, $name );
526
# Treat overloaded objects as numbers if we're asked to do a
527
# numeric comparison.
529
= $numeric_cmps{$type}
533
$self->diag(<<"END") if $error;
534
An error occurred while using $type:
535
------------------------------------
537
------------------------------------
541
$self->$unoverload( \$got, \$expect );
543
if( $type =~ /^(eq|==)$/ ) {
544
$self->_is_diag( $got, $type, $expect );
546
elsif( $type =~ /^(ne|!=)$/ ) {
547
$self->_isnt_diag( $got, $type );
550
$self->_cmp_diag( $got, $type, $expect );
557
my( $self, $got, $type, $expect ) = @_;
559
$got = defined $got ? "'$got'" : 'undef';
560
$expect = defined $expect ? "'$expect'" : 'undef';
562
local $Level = $Level + 1;
563
return $self->diag(<<"DIAGNOSTIC");
570
sub _caller_context {
573
my( $pack, $file, $line ) = $self->caller(1);
576
$code .= "#line $line $file\n" if defined $file and defined $line;
584
my( $self, $reason ) = @_;
586
$self->{Bailed_Out} = 1;
587
$self->_print("Bail out! $reason");
593
*BAILOUT = \&BAIL_OUT;
598
my( $self, $why ) = @_;
600
$self->_unoverload_str( \$why );
604
lock( $self->{Curr_Test} );
605
$self->{Curr_Test}++;
607
$self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share(
618
$out .= " $self->{Curr_Test}" if $self->use_numbers;
620
$out .= " $why" if length $why;
631
my( $self, $why ) = @_;
636
lock( $self->{Curr_Test} );
637
$self->{Curr_Test}++;
639
$self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share(
650
$out .= " $self->{Curr_Test}" if $self->use_numbers;
651
$out .= " # TODO & SKIP $why\n";
661
my( $self, $regex ) = @_;
662
my $usable_regex = undef;
664
return $usable_regex unless defined $regex;
669
if( _is_qr($regex) ) {
670
$usable_regex = $regex;
672
# Check for '/foo/' or 'm,foo,'
673
elsif(( $re, $opts ) = $regex =~ m{^ /(.*)/ (\w*) $ }sx or
674
( undef, $re, $opts ) = $regex =~ m,^ m([^\w\s]) (.+) \1 (\w*) $,sx
677
$usable_regex = length $opts ? "(?$opts)$re" : $re;
680
return $usable_regex;
686
# is_regexp() checks for regexes in a robust manner, say if they're
688
return re::is_regexp($regex) if defined &re::is_regexp;
689
return ref $regex eq 'Regexp';
693
my( $self, $this, $regex, $cmp, $name ) = @_;
696
my $usable_regex = $self->maybe_regex($regex);
697
unless( defined $usable_regex ) {
698
local $Level = $Level + 1;
699
$ok = $self->ok( 0, $name );
700
$self->diag(" '$regex' doesn't look much like a regex to me.");
705
## no critic (BuiltinFunctions::ProhibitStringyEval)
708
my $code = $self->_caller_context;
710
local( $@, $!, $SIG{__DIE__} ); # isolate eval
712
# Yes, it has to look like this or 5.4.5 won't see the #line
714
# Don't ask me, man, I just work here.
716
$code" . q{$test = $this =~ /$usable_regex/ ? 1 : 0};
718
$test = !$test if $cmp eq '!~';
720
local $Level = $Level + 1;
721
$ok = $self->ok( $test, $name );
725
$this = defined $this ? "'$this'" : 'undef';
726
my $match = $cmp eq '=~' ? "doesn't match" : "matches";
728
local $Level = $Level + 1;
729
$self->diag( sprintf <<'DIAGNOSTIC', $this, $match, $regex );
739
# I'm not ready to publish this. It doesn't deal with array return
740
# values from the code or context.
745
my( $self, $code, %opts ) = @_;
750
local $!; # eval can mess up $!
751
local $@; # don't set $@ in the test
752
local $SIG{__DIE__}; # don't trip an outside DIE handler.
753
$return = eval { $code->() };
757
die $error if $error and $opts{die_on_fail};
759
return wantarray ? ( $return, $error ) : $return;
766
my $maybe_fh = shift;
767
return 0 unless defined $maybe_fh;
769
return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref
770
return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob
772
return eval { $maybe_fh->isa("IO::Handle") } ||
773
# 5.5.4's tied() and can() doesn't like getting undef
774
eval { ( tied($maybe_fh) || '' )->can('TIEHANDLE') };
780
my( $self, $level ) = @_;
782
if( defined $level ) {
791
my( $self, $use_nums ) = @_;
793
if( defined $use_nums ) {
794
$self->{Use_Nums} = $use_nums;
796
return $self->{Use_Nums};
801
foreach my $attribute (qw(No_Header No_Ending No_Diag)) {
802
my $method = lc $attribute;
805
my( $self, $no ) = @_;
808
$self->{$attribute} = $no;
810
return $self->{$attribute};
813
no strict 'refs'; ## no critic
814
*{ __PACKAGE__ . '::' . $method } = $code;
822
$self->_print_comment( $self->_diag_fh, @_ );
830
$self->_print_comment( $self->output, @_ );
836
local $Level = $Level + 1;
837
return $self->in_todo ? $self->todo_output : $self->failure_output;
841
my( $self, $fh, @msgs ) = @_;
843
return if $self->no_diag;
846
# Prevent printing headers when compiling (i.e. -c)
849
# Smash args together like print does.
850
# Convert undef to 'undef' so its readable.
851
my $msg = join '', map { defined($_) ? $_ : 'undef' } @msgs;
853
# Escape the beginning, _print will take care of the rest.
856
local $Level = $Level + 1;
857
$self->_print_to_fh( $fh, $msg );
870
$self->_try(sub { require Data::Dumper }, die_on_fail => 1);
872
my $dumper = Data::Dumper->new( [$_] );
873
$dumper->Indent(1)->Terse(1);
874
$dumper->Sortkeys(1) if $dumper->can("Sortkeys");
885
return $self->_print_to_fh( $self->output, @_ );
889
my( $self, $fh, @msgs ) = @_;
891
# Prevent printing headers when only compiling. Mostly for when
892
# tests are deparsed with B::Deparse
895
my $msg = join '', @msgs;
897
local( $\, $", $, ) = ( undef, ' ', '' );
899
# Escape each line after the first with a # so we don't
900
# confuse Test::Harness.
901
$msg =~ s{\n(?!\z)}{\n# }sg;
903
# Stick a newline on the end if it needs it.
904
$msg .= "\n" unless $msg =~ /\n\z/;
906
return print $fh $msg;
912
my( $self, $fh ) = @_;
915
$self->{Out_FH} = $self->_new_fh($fh);
917
return $self->{Out_FH};
921
my( $self, $fh ) = @_;
924
$self->{Fail_FH} = $self->_new_fh($fh);
926
return $self->{Fail_FH};
930
my( $self, $fh ) = @_;
933
$self->{Todo_FH} = $self->_new_fh($fh);
935
return $self->{Todo_FH};
940
my($file_or_fh) = shift;
943
if( $self->is_fh($file_or_fh) ) {
947
open $fh, ">", $file_or_fh
948
or $self->croak("Can't open test output log $file_or_fh: $!");
957
my $old_fh = select $fh;
964
my( $Testout, $Testerr );
966
sub _dup_stdhandles {
969
$self->_open_testhandles;
971
# Set everything to unbuffered else plain prints to STDOUT will
972
# come out in the wrong order from our own prints.
973
_autoflush($Testout);
974
_autoflush( \*STDOUT );
975
_autoflush($Testerr);
976
_autoflush( \*STDERR );
978
$self->reset_outputs;
983
my $Opened_Testhandles = 0;
985
sub _open_testhandles {
988
return if $Opened_Testhandles;
990
# We dup STDOUT and STDERR so people can change them in their
991
# test suites while still getting normal test output.
992
open( $Testout, ">&STDOUT" ) or die "Can't dup STDOUT: $!";
993
open( $Testerr, ">&STDERR" ) or die "Can't dup STDERR: $!";
995
# $self->_copy_io_layers( \*STDOUT, $Testout );
996
# $self->_copy_io_layers( \*STDERR, $Testerr );
998
$Opened_Testhandles = 1;
1003
sub _copy_io_layers {
1004
my( $self, $src, $dst ) = @_;
1009
my @src_layers = PerlIO::get_layers($src);
1011
binmode $dst, join " ", map ":$_", @src_layers if @src_layers;
1023
$self->output ($Testout);
1024
$self->failure_output($Testerr);
1025
$self->todo_output ($Testout);
1032
sub _message_at_caller {
1035
local $Level = $Level + 1;
1036
my( $pack, $file, $line ) = $self->caller;
1037
return join( "", @_ ) . " at $file line $line.\n";
1042
return warn $self->_message_at_caller(@_);
1047
return die $self->_message_at_caller(@_);
1053
unless( $self->{Have_Plan} ) {
1054
local $Level = $Level + 2;
1055
$self->croak("You tried to run a test without a plan");
1064
my( $self, $num ) = @_;
1066
lock( $self->{Curr_Test} );
1067
if( defined $num ) {
1068
$self->croak("Can't change the current test number without a plan!")
1069
unless $self->{Have_Plan};
1071
$self->{Curr_Test} = $num;
1073
# If the test counter is being pushed forward fill in the details.
1074
my $test_results = $self->{Test_Results};
1075
if( $num > @$test_results ) {
1076
my $start = @$test_results ? @$test_results : 0;
1077
for( $start .. $num - 1 ) {
1078
$test_results->[$_] = &share(
1082
reason => 'incrementing test number',
1089
# If backward, wipe history. Its their funeral.
1090
elsif( $num < @$test_results ) {
1091
$#{$test_results} = $num - 1;
1094
return $self->{Curr_Test};
1102
return map { $_->{'ok'} } @{ $self->{Test_Results} };
1109
return @{ $self->{Test_Results} };
1115
my( $self, $pack ) = @_;
1117
return $self->{Todo} if defined $self->{Todo};
1119
local $Level = $Level + 1;
1120
my $todo = $self->find_TODO($pack);
1121
return $todo if defined $todo;
1129
my( $self, $pack ) = @_;
1131
$pack = $pack || $self->caller(1) || $self->exported_to;
1132
return unless $pack;
1134
no strict 'refs'; ## no critic
1135
return ${ $pack . '::TODO' };
1143
local $Level = $Level + 1;
1144
return( defined $self->{Todo} || $self->find_TODO ) ? 1 : 0;
1151
my $message = @_ ? shift : '';
1153
$self->{Start_Todo}++;
1154
if( $self->in_todo ) {
1155
push @{ $self->{Todo_Stack} } => $self->todo;
1157
$self->{Todo} = $message;
1167
if( !$self->{Start_Todo} ) {
1168
$self->croak('todo_end() called without todo_start()');
1171
$self->{Start_Todo}--;
1173
if( $self->{Start_Todo} && @{ $self->{Todo_Stack} } ) {
1174
$self->{Todo} = pop @{ $self->{Todo_Stack} };
1177
delete $self->{Todo};
1185
sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
1186
my( $self, $height ) = @_;
1189
my $level = $self->level + $height + 1;
1192
@caller = CORE::caller( $level );
1195
return wantarray ? @caller : $caller[0];
1206
$self->_whoa( $self->{Curr_Test} < 0, 'Says here you ran a negative number of tests!' );
1207
$self->_whoa( !$self->{Have_Plan} and $self->{Curr_Test},
1208
'Somehow your tests ran without a plan!' );
1209
$self->_whoa( $self->{Curr_Test} != @{ $self->{Test_Results} },
1210
'Somehow you got a different number of results than tests ran!' );
1218
my( $self, $check, $desc ) = @_;
1220
local $Level = $Level + 1;
1221
$self->croak(<<"WHOA");
1223
This should never happen! Please contact the author immediately!
1233
$? = $_[0]; ## no critic (Variables::RequireLocalizedPunctuationVars)
1243
my $real_exit_code = $?;
1244
$self->_sanity_check();
1246
# Don't bother with an ending if this is a forked copy. Only the parent
1247
# should do the ending.
1248
if( $self->{Original_Pid} != $$ ) {
1252
# Exit if plan() was never called. This is so "require Test::Simple"
1254
if( !$self->{Have_Plan} ) {
1258
# Don't do an ending if we bailed out.
1259
if( $self->{Bailed_Out} ) {
1263
# Figure out if we passed or failed and print helpful messages.
1264
my $test_results = $self->{Test_Results};
1265
if(@$test_results) {
1266
# The plan? We have no plan.
1267
if( $self->{No_Plan} ) {
1268
$self->_print("1..$self->{Curr_Test}\n") unless $self->no_header;
1269
$self->{Expected_Tests} = $self->{Curr_Test};
1272
# Auto-extended arrays and elements which aren't explicitly
1273
# filled in with a shared reference will puke under 5.8.0
1274
# ithreads. So we have to fill them in by hand. :(
1275
my $empty_result = &share( {} );
1276
for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
1277
$test_results->[$idx] = $empty_result
1278
unless defined $test_results->[$idx];
1281
my $num_failed = grep !$_->{'ok'}, @{$test_results}[ 0 .. $self->{Curr_Test} - 1 ];
1283
my $num_extra = $self->{Curr_Test} - $self->{Expected_Tests};
1285
if( $num_extra != 0 ) {
1286
my $s = $self->{Expected_Tests} == 1 ? '' : 's';
1287
$self->diag(<<"FAIL");
1288
Looks like you planned $self->{Expected_Tests} test$s but ran $self->{Curr_Test}.
1293
my $num_tests = $self->{Curr_Test};
1294
my $s = $num_failed == 1 ? '' : 's';
1296
my $qualifier = $num_extra == 0 ? '' : ' run';
1298
$self->diag(<<"FAIL");
1299
Looks like you failed $num_failed test$s of $num_tests$qualifier.
1303
if($real_exit_code) {
1304
$self->diag(<<"FAIL");
1305
Looks like your test exited with $real_exit_code just after $self->{Curr_Test}.
1308
_my_exit($real_exit_code) && return;
1313
$exit_code = $num_failed <= 254 ? $num_failed : 254;
1315
elsif( $num_extra != 0 ) {
1322
_my_exit($exit_code) && return;
1324
elsif( $self->{Skip_All} ) {
1325
_my_exit(0) && return;
1327
elsif($real_exit_code) {
1328
$self->diag(<<"FAIL");
1329
Looks like your test exited with $real_exit_code before it could output anything.
1331
_my_exit($real_exit_code) && return;
1334
$self->diag("No tests run!\n");
1335
_my_exit(255) && return;
1338
$self->_whoa( 1, "We fell off the end of _ending()" );
1342
$Test->_ending if defined $Test and !$Test->no_ending;