diff options
author | Peter Rabbitson <ribasushi@cpan.org> | 2015-10-20 22:02:19 -0400 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2015-10-20 22:02:19 -0400 |
commit | c37b157e68b43a1b2cfcb063b3b0f6b47f06b730 (patch) | |
tree | bd99c42e8f1a563008fae3ec3d88dcd0f59fe55b /dist/Carp | |
parent | c8bca6066b56f87ea8698cb8e279067506c93985 (diff) | |
download | perl-c37b157e68b43a1b2cfcb063b3b0f6b47f06b730.tar.gz |
Carp: fix test not working on older toolchain
The newly introduced _dump() utility function is a faithful
representation of what explain() does in newer Test::More versions
Diffstat (limited to 'dist/Carp')
-rw-r--r-- | dist/Carp/Makefile.PL | 2 | ||||
-rw-r--r-- | dist/Carp/t/Carp_overload.t | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/dist/Carp/Makefile.PL b/dist/Carp/Makefile.PL index 7aa6132c13..e97754c875 100644 --- a/dist/Carp/Makefile.PL +++ b/dist/Carp/Makefile.PL @@ -12,7 +12,7 @@ WriteMakefile( "Exporter" => 0, "ExtUtils::MakeMaker" => 0, "IPC::Open3" => "1.0103", - "Test::More" => 0, + "Test::More" => "0.47", "overload" => 0, "parent" => 0.217, "strict" => 0, diff --git a/dist/Carp/t/Carp_overload.t b/dist/Carp/t/Carp_overload.t index 6a0dbf997f..125dd7e92f 100644 --- a/dist/Carp/t/Carp_overload.t +++ b/dist/Carp/t/Carp_overload.t @@ -4,6 +4,11 @@ use Test::More tests => 7; use Carp; +use Data::Dumper (); +sub _dump ($) { + Data::Dumper->new(\@_)->Indent(1)->Terse(1)->Dump; +} + my $o = Stringable->new(key => 'Baz'); my $msg = call(\&with_longmess, $o, {bar => 'buzz'}); @@ -16,7 +21,7 @@ like($msg, qr/, HASH\(0x[[:xdigit:]]+\)\)/, "HASH *not* stringified"); local $Carp::RefArgFormatter = sub { $called++; - join '', explain $_[0]; + join '', _dump $_[0]; }; $msg = call(\&with_longmess, $o, {bar => 'buzz'}); @@ -27,7 +32,7 @@ like($msg, qr/, HASH\(0x[[:xdigit:]]+\)\)/, "HASH *not* stringified"); $o = CarpTracable->new(key => 'Bax'); $msg = call(\&with_longmess, $o, {bar => 'buzz'}); ok($o->{called}, "CARP_TRACE called"); -like($msg, qr/, TRACE:CarpTracable=Bax, /, "CARP_TRACE output used") or diag explain $msg; +like($msg, qr/, TRACE:CarpTracable=Bax, /, "CARP_TRACE output used") or diag _dump $msg; like($msg, qr/, HASH\(0x[[:xdigit:]]+\)\)/, "HASH not stringified again"); sub call @@ -57,7 +62,9 @@ sub as_string package CarpTracable; -use parent -norequire => 'Stringable'; +# need to set inheritance of new() etc before the +# CarpTracable->new calls higher up +BEGIN { our @ISA = 'Stringable' } sub CARP_TRACE { |