diff options
Diffstat (limited to 't/op/universal.t')
-rw-r--r-- | t/op/universal.t | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/t/op/universal.t b/t/op/universal.t index 50d1782384..494bc99de7 100644 --- a/t/op/universal.t +++ b/t/op/universal.t @@ -10,7 +10,7 @@ BEGIN { require "./test.pl"; } -plan tests => 144; +plan tests => 143; $a = {}; bless $a, "Bob"; @@ -137,12 +137,10 @@ ok ! (eval { aversion->VERSION(2.719) }); like $@, qr/^Invalid version format/; my $subs = join ' ', sort grep { defined &{"UNIVERSAL::$_"} } keys %UNIVERSAL::; -## The test for import here is *not* because we want to ensure that UNIVERSAL -## can always import; it is an historical accident that UNIVERSAL can import. if ('a' lt 'A') { - is $subs, "can import isa DOES VERSION"; + is $subs, "can isa DOES VERSION"; } else { - is $subs, "DOES VERSION can import isa"; + is $subs, "DOES VERSION can isa"; } ok $a->isa("UNIVERSAL"); @@ -178,16 +176,6 @@ ok ! $a->can("export_tags"); # a method in Exporter ok ! UNIVERSAL::isa("\xff\xff\xff\0", 'HASH'); { - package Pickup; - no warnings "deprecated"; - use UNIVERSAL qw( isa can VERSION ); - - ::ok isa "Pickup", UNIVERSAL; - ::cmp_ok can( "Pickup", "can" ), '==', \&UNIVERSAL::can; - ::ok VERSION "UNIVERSAL" ; -} - -{ # test isa() and can() on magic variables "Human" =~ /(.*)/; ok $1->isa("Human"); @@ -274,11 +262,15 @@ use warnings "deprecated"; my $m; local $SIG{__WARN__} = sub { $m = $_[0] }; eval "use UNIVERSAL 'can'"; - like($m, qr/^UNIVERSAL->import is deprecated/, - "deprecation warning for UNIVERSAL->import('can')"); + like($@, qr/^UNIVERSAL does not export anything\b/, + "error for UNIVERSAL->import('can')"); + is($m, undef, + "no deprecation warning for UNIVERSAL->import('can')"); undef $m; eval "use UNIVERSAL"; + is($@, "", + "no error for UNIVERSAL->import"); is($m, undef, "no deprecation warning for UNIVERSAL->import"); } |