diff options
author | Chad Granum <chad.granum@dreamhost.com> | 2014-08-15 08:40:10 -0700 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2014-08-16 23:19:29 +0200 |
commit | 6bdb88770f849c47b5c09e733ac460ce3e9dbc97 (patch) | |
tree | 3eda7f11aea1019f7a802c1caecfb81ab26e7761 /dist/Carp | |
parent | 7d16fb5f4895e672484c0b7490722d46df82b099 (diff) | |
download | perl-6bdb88770f849c47b5c09e733ac460ce3e9dbc97.tar.gz |
Update to include latest Test::Builder alpha
Also updated some tests that the new builder broke
Diffstat (limited to 'dist/Carp')
-rw-r--r-- | dist/Carp/t/Carp.t | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/dist/Carp/t/Carp.t b/dist/Carp/t/Carp.t index b12c482ae8..2e041841ec 100644 --- a/dist/Carp/t/Carp.t +++ b/dist/Carp/t/Carp.t @@ -310,15 +310,13 @@ cluck_undef( 0, "undef", 2, undef, 4 ); # check that Carp respects CORE::GLOBAL::caller override after Carp # has been compiled +require B; # For older Test::More versions that do not auto-load it for my $bodge_job ( 2, 1, 0 ) { SKIP: { skip "can't safely detect incomplete caller override on perl $]", 6 if $bodge_job && !Carp::CALLER_OVERRIDE_CHECK_OK; print '# ', ( $bodge_job ? 'Not ' : '' ), "setting \@DB::args in caller override\n"; - if ( $bodge_job == 1 ) { - require B; - print "# required B\n"; - } + my $accum = ''; local *CORE::GLOBAL::caller = sub { local *__ANON__ = "fakecaller"; @@ -334,11 +332,22 @@ for my $bodge_job ( 2, 1, 0 ) { SKIP: { return CORE::caller( ( $_[0] || 0 ) + 1 ); } }; + eval "scalar caller()"; like( $accum, qr/main::fakecaller/, "test CORE::GLOBAL::caller override in eval" ); + $accum = ''; - my $got = XA::long(42); + my $got; + { + # Test::Builder loads B now, so we have to pretend it is not loaded. + # Carp simply wraps a call to svref_2object in an eval, so if that + # method does not exist we emulate not having B. Localizing the glob + # temporarily removes the sub. + local *B::svref_2object unless $bodge_job == 1; + $got = XA::long(42); + } + like( $accum, qr/main::fakecaller/, "test CORE::GLOBAL::caller override in Carp" ); my $package = 'XA'; |