This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid an assertion failure when overloading readpipe.
[perl5.git] / t / op / gv.t
index d243fb7..b5f63be 100755 (executable)
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -12,7 +12,7 @@ BEGIN {
 use warnings;
 
 require './test.pl';
-plan( tests => 154 );
+plan( tests => 160 );
 
 # type coersion on assignment
 $foo = 'foo';
@@ -453,6 +453,38 @@ foreach my $value ([1,2,3], {1=>2}, *STDOUT{IO}, \&ok, *STDOUT{FORMAT}) {
        "PERL_DONT_CREATE_GVSV shouldn't affect thingy syntax under strict");
 }
 
+{
+    # Bug reported by broquaint on IRC
+    *slosh::{HASH}->{ISA}=[];
+    slosh->import;
+    pass("gv_fetchmeth coped with the unexpected");
+
+    # An audit found these:
+    {
+       package slosh;
+       sub rip {
+           my $s = shift;
+           $s->SUPER::rip;
+       }
+    }
+    eval {slosh->rip;};
+    like ($@, qr/^Can't locate object method "rip"/, "Even with SUPER");
+
+    is(slosh->isa('swoosh'), '');
+
+    $CORE::GLOBAL::{"lock"}=[];
+    eval "no warnings; lock";
+    like($@, qr/^Not enough arguments for lock/,
+       "Can't trip up general keyword overloading");
+
+    $CORE::GLOBAL::{"readline"}=[];
+    eval "no warnings; <STDOUT>";
+    is($@, '', "Can't trip up readline overloading");
+
+    $CORE::GLOBAL::{"readpipe"}=[];
+    eval "`` if 0";
+    is($@, '', "Can't trip up readpipe overloading");
+}
 __END__
 Perl
 Rules