summaryrefslogtreecommitdiff
path: root/dist/Carp
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2013-08-23 22:58:41 +0100
committerZefram <zefram@fysh.org>2013-08-24 02:17:44 +0100
commitf864cbead6c53937ae2608099abd8c3d838de505 (patch)
tree1a407204efc18a60790cda8069ecdf9bd5988c0d /dist/Carp
parent8ef6e574dc20ae6630168de22486c9083ad307af (diff)
downloadperl-f864cbead6c53937ae2608099abd8c3d838de505.tar.gz
regularise test for Carp vivifying B stash
There's an old test to check that Carp doesn't vivify B:: despite attempting to use B::svref_2object(). Turn this into the same kind of test now used for overload::StrVal() and utf8::downgrade(), testing more cleanly for stash vivification and also testing for GV vivification.
Diffstat (limited to 'dist/Carp')
-rw-r--r--dist/Carp/t/Carp.t21
-rw-r--r--dist/Carp/t/vivify_gv.t6
-rw-r--r--dist/Carp/t/vivify_stash.t8
3 files changed, 10 insertions, 25 deletions
diff --git a/dist/Carp/t/Carp.t b/dist/Carp/t/Carp.t
index f5137607a8..a56999704e 100644
--- a/dist/Carp/t/Carp.t
+++ b/dist/Carp/t/Carp.t
@@ -3,7 +3,7 @@ no warnings "once";
use Config;
use IPC::Open3 1.0103 qw(open3);
-use Test::More tests => 63;
+use Test::More tests => 62;
sub runperl {
my(%args) = @_;
@@ -419,25 +419,6 @@ SKIP:
);
}
-SKIP:
-{
- skip "IPC::Open3::open3 needs porting", 1 if $Is_VMS;
- skip("B:: always created when static", 1)
- if $Config{static_ext} =~ /\bB\b/;
- is(
- runperl(
- prog => q<
- use Carp;
- $SIG{__WARN__} = sub{};
- carp (qq(A duck, but which duck?));
- print q(ok) unless exists $::{q(B::)};
- >,
- ),
- 'ok',
- 'Carp does not autovivify *B::',
- );
-}
-
# [perl #96672]
<D::DATA> for 1..2;
eval { croak 'heek' };
diff --git a/dist/Carp/t/vivify_gv.t b/dist/Carp/t/vivify_gv.t
index 62602a4e88..6c76874991 100644
--- a/dist/Carp/t/vivify_gv.t
+++ b/dist/Carp/t/vivify_gv.t
@@ -1,14 +1,16 @@
-BEGIN { print "1..3\n"; }
+BEGIN { print "1..4\n"; }
our $has_is_utf8; BEGIN { $has_is_utf8 = exists($utf8::{"is_utf8"}); }
our $has_dgrade; BEGIN { $has_dgrade = exists($utf8::{"downgrade"}); }
our $has_strval; BEGIN { $has_strval = exists($overload::{"StrVal"}); }
+our $has_sv2obj; BEGIN { $has_sv2obj = exists($B::{"svref_2object"}); }
use Carp;
sub { Carp::longmess() }->(\1);
print !(exists($utf8::{"is_utf8"}) xor $has_is_utf8) ? "" : "not ", "ok 1\n";
print !(exists($utf8::{"downgrade"}) xor $has_dgrade) ? "" : "not ", "ok 2\n";
-print !(exists($overload::{"StrVal"}) xor $has_strval) ? "" : "not ", "ok 3\n";
+print !(exists($overload::{"StrVal"}) xor $has_sv2obj) ? "" : "not ", "ok 3\n";
+print !(exists($B::{"svref_2object"}) xor $has_sv2obj) ? "" : "not ", "ok 4\n";
1;
diff --git a/dist/Carp/t/vivify_stash.t b/dist/Carp/t/vivify_stash.t
index 68dc9a7258..536b35ddfb 100644
--- a/dist/Carp/t/vivify_stash.t
+++ b/dist/Carp/t/vivify_stash.t
@@ -1,23 +1,25 @@
-BEGIN { print "1..4\n"; }
+BEGIN { print "1..5\n"; }
our $has_utf8; BEGIN { $has_utf8 = exists($::{"utf8::"}); }
our $has_overload; BEGIN { $has_overload = exists($::{"overload::"}); }
+our $has_B; BEGIN { $has_B = exists($::{"B::"}); }
use Carp;
sub { Carp::longmess() }->(\1);
print !(exists($::{"utf8::"}) xor $has_utf8) ? "" : "not ", "ok 1\n";
print !(exists($::{"overload::"}) xor $has_overload) ? "" : "not ", "ok 2\n";
+print !(exists($::{"B::"}) xor $has_B) ? "" : "not ", "ok 3\n";
# Autovivify $::{"overload::"}
() = \$::{"overload::"};
() = \$::{"utf8::"};
eval { sub { Carp::longmess() }->(\1) };
-print $@ eq '' ? "ok 3\n" : "not ok 3\n# $@";
+print $@ eq '' ? "ok 4\n" : "not ok 4\n# $@";
# overload:: glob without hash
undef *{"overload::"};
eval { sub { Carp::longmess() }->(\1) };
-print $@ eq '' ? "ok 4\n" : "not ok 4\n# $@";
+print $@ eq '' ? "ok 5\n" : "not ok 5\n# $@";
1;