Re: [PATCH: perl@8342] comp/proto..........FAILED tests 112-123
[p5sagit/p5-mst-13.2.git] / t / pragma / overload.t
index c142a64..bf24c07 100755 (executable)
@@ -133,6 +133,7 @@ test ( $a eq "087");                # 29
 test ( $b eq "88");            # 30
 test (ref $a eq "Oscalar");    # 31
 
+undef $b;                      # Destroying updates tables too...
 
 eval q[package Oscalar; use overload ('++' => sub { $ {$_[0]} += 2; $_[0] } ) ];
 
@@ -939,7 +940,7 @@ unless ($aaa) {
 {
     # check the Odd number of arguments for overload::constant warning
     my $a = "" ;
-    local $SIG{__WARN__} = sub {$a = @_[0]} ;
+    local $SIG{__WARN__} = sub {$a = $_[0]} ;
     $x = eval ' overload::constant "integer" ; ' ;
     test($a eq "") ; # 210
     use warnings 'overload' ;
@@ -950,7 +951,7 @@ unless ($aaa) {
 {
     # check the `$_[0]' is not an overloadable type warning
     my $a = "" ;
-    local $SIG{__WARN__} = sub {$a = @_[0]} ;
+    local $SIG{__WARN__} = sub {$a = $_[0]} ;
     $x = eval ' overload::constant "fred" => sub {} ; ' ;
     test($a eq "") ; # 212
     use warnings 'overload' ;
@@ -961,7 +962,7 @@ unless ($aaa) {
 {
     # check the `$_[1]' is not a code reference warning
     my $a = "" ;
-    local $SIG{__WARN__} = sub {$a = @_[0]} ;
+    local $SIG{__WARN__} = sub {$a = $_[0]} ;
     $x = eval ' overload::constant "integer" => 1; ' ;
     test($a eq "") ; # 214
     use warnings 'overload' ;
@@ -969,5 +970,19 @@ unless ($aaa) {
     test($a =~ /^`1' is not a code reference at/); # 215
 }
 
+# make sure that we don't inifinitely recurse
+{
+  my $c = 0;
+  package Recurse;
+  use overload '""'    => sub { shift },
+               '0+'    => sub { shift },
+               'bool'  => sub { shift },
+               fallback => 1;
+  my $x = bless([]);
+  main::test("$x" =~ /Recurse=ARRAY/);         # 216
+  main::test($x);                               # 217
+  main::test($x+0 =~ /Recurse=ARRAY/);         # 218
+};
+
 # Last test is:
-sub last {215}
+sub last {218}