$SIG{__WARN__} = sub {
print "ok $1\n"
- if $_[0] =~ m!ok (\d+)$! };
+ if $_[0] =~ m!ok (\d+)\n at .+\b(?i:carp\.t) line \d+$! };
carp "ok 2\n";
$tid_msg = " thread $tid" if $tid;
}
- { if ($err =~ /\n$/) { # extra block to localise $1 etc
- $mess = $err;
- }
- else {
- my %i = caller_info($i);
- $mess = "$err at $i{file} line $i{line}$tid_msg\n";
- }}
+ my %i = caller_info($i);
+ $mess = "$err at $i{file} line $i{line}$tid_msg\n";
while (my %i = caller_info(++$i)) {
$mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
sub ret_summary {
my ($i, @error) = @_;
- my $mess;
my $err = join '', @error;
$i++;
local $SIG{__WARN__} = sub { push @warning, @_ };
carp "this carp was predeclared and autoused\n";
ok( scalar @warning, 1 );
- ok( $warning[0], "this carp was predeclared and autoused\n" );
+ ok( $warning[0], qr/^this carp was predeclared and autoused\n/ );
eval { croak "It is but a scratch!" };
ok( $@, qr/^It is but a scratch!/);