Change 33594 by [EMAIL PROTECTED] on 2008/03/28 22:03:52

        Subject: [PATCH] Re: Tests failed on PPC64
        From: Dominic Dunlop <[EMAIL PROTECTED]>
        Message-Id: <[EMAIL PROTECTED]>
        Date: Fri, 14 Mar 2008 14:45:39 +0100

Affected files ...

... //depot/perl/t/op/reg_namedcapture.t#2 edit
... //depot/perl/t/op/switch.t#5 edit

Differences ...

==== //depot/perl/t/op/reg_namedcapture.t#2 (text) ====
Index: perl/t/op/reg_namedcapture.t
--- perl/t/op/reg_namedcapture.t#1~31453~       2007-06-23 12:53:53.000000000 
-0700
+++ perl/t/op/reg_namedcapture.t        2008-03-28 15:03:52.000000000 -0700
@@ -3,9 +3,13 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    unless ( -r "$INC[0]/Errno.pm") {
+      print "1..0 # Skip: Errno.pm not yet available\n";
+      exit 0;
+    }
 }
 
-# WARNING: Do not use anymodules as part of this test code.
+# WARNING: Do not directly use any modules as part of this test code.
 # We could get action at a distance that would invalidate the tests.
 
 print "1..2\n";
@@ -15,6 +19,8 @@
 'X'=~/(?<X>X)/;
 print eval '*X{HASH}{X} || 1' ? "" :"not ","ok ",++$test,"\n";
 
-# And since its a similar case we check %! as well
+# And since it's a similar case we check %! as well. Note that
+# this can't be done until ../lib/Errno.pm is in place, as the
+# glob hits $!, which needs that module.
 *Y = *!;
 print 0<keys(%Y) ? "" :"not ","ok ",++$test,"\n";

==== //depot/perl/t/op/switch.t#5 (text) ====
Index: perl/t/op/switch.t
--- perl/t/op/switch.t#4~33434~ 2008-03-04 09:17:54.000000000 -0800
+++ perl/t/op/switch.t  2008-03-28 15:03:52.000000000 -0700
@@ -802,98 +802,101 @@
     is($ok2, 1, "Calling sub indirectly (false)");
 }
 
-# Test overloading
-{ package OverloadTest;
-
-    use overload '""' => sub{"string value of obj"};
-
-    use overload "~~" => sub {
-        my ($self, $other, $reversed) = @_;
-        if ($reversed) {
-           $self->{left}  = $other;
-           $self->{right} = $self;
-           $self->{reversed} = 1;
-        } else {
-           $self->{left}  = $self;
-           $self->{right} = $other;
-           $self->{reversed} = 0;
-        }
-       $self->{called} = 1;
-       return $self->{retval};
-    };
+SKIP: {
+    skip "Scalar/Util.pm not yet available", 20
+       unless -r "$INC[0]/Scalar/Util.pm";
+    # Test overloading
+    { package OverloadTest;
+
+      use overload '""' => sub{"string value of obj"};
+
+      use overload "~~" => sub {
+         my ($self, $other, $reversed) = @_;
+         if ($reversed) {
+             $self->{left}  = $other;
+             $self->{right} = $self;
+             $self->{reversed} = 1;
+         } else {
+             $self->{left}  = $self;
+             $self->{right} = $other;
+             $self->{reversed} = 0;
+         }
+         $self->{called} = 1;
+         return $self->{retval};
+      };
     
-    sub new {
-       my ($pkg, $retval) = @_;
-       bless {
-           called => 0,
-           retval => $retval,
-       }, $pkg;
+      sub new {
+         my ($pkg, $retval) = @_;
+         bless {
+                called => 0,
+                retval => $retval,
+               }, $pkg;
+      }
+  }
+
+    {
+       my $test = "Overloaded obj in given (true)";
+       my $obj = OverloadTest->new(1);
+       my $matched;
+       given($obj) {
+           when ("other arg") {$matched = 1}
+           default {$matched = 0}
+       }
+    
+       is($obj->{called},  1, "$test: called");
+       ok($matched, "$test: matched");
+       is($obj->{left}, "string value of obj", "$test: left");
+       is($obj->{right}, "other arg", "$test: right");
+       ok(!$obj->{reversed}, "$test: not reversed");
     }
-}
 
-{
-    my $test = "Overloaded obj in given (true)";
-    my $obj = OverloadTest->new(1);
-    my $matched;
-    given($obj) {
-       when ("other arg") {$matched = 1}
-       default {$matched = 0}
-    }
+    {
+       my $test = "Overloaded obj in given (false)";
+       my $obj = OverloadTest->new(0);
+       my $matched;
+       given($obj) {
+           when ("other arg") {$matched = 1}
+       }
     
-    is($obj->{called},  1, "$test: called");
-    ok($matched, "$test: matched");
-    is($obj->{left}, "string value of obj", "$test: left");
-    is($obj->{right}, "other arg", "$test: right");
-    ok(!$obj->{reversed}, "$test: not reversed");
-}
-
-{
-    my $test = "Overloaded obj in given (false)";
-    my $obj = OverloadTest->new(0);
-    my $matched;
-    given($obj) {
-       when ("other arg") {$matched = 1}
+       is($obj->{called},  1, "$test: called");
+       ok(!$matched, "$test: not matched");
+       is($obj->{left}, "string value of obj", "$test: left");
+       is($obj->{right}, "other arg", "$test: right");
+       ok(!$obj->{reversed}, "$test: not reversed");
     }
-    
-    is($obj->{called},  1, "$test: called");
-    ok(!$matched, "$test: not matched");
-    is($obj->{left}, "string value of obj", "$test: left");
-    is($obj->{right}, "other arg", "$test: right");
-    ok(!$obj->{reversed}, "$test: not reversed");
-}
 
-{
-    my $test = "Overloaded obj in when (true)";
-    my $obj = OverloadTest->new(1);
-    my $matched;
-    given("topic") {
-       when ($obj) {$matched = 1}
-       default {$matched = 0}
-    }
+    {
+       my $test = "Overloaded obj in when (true)";
+       my $obj = OverloadTest->new(1);
+       my $matched;
+       given("topic") {
+           when ($obj) {$matched = 1}
+           default {$matched = 0}
+       }
     
-    is($obj->{called},  1, "$test: called");
-    ok($matched, "$test: matched");
-    is($obj->{left}, "topic", "$test: left");
-    is($obj->{right}, "string value of obj", "$test: right");
-    ok($obj->{reversed}, "$test: reversed");
-}
-
-{
-    my $test = "Overloaded obj in when (false)";
-    my $obj = OverloadTest->new(0);
-    my $matched;
-    given("topic") {
-       when ($obj) {$matched = 1}
-       default {$matched = 0}
+       is($obj->{called},  1, "$test: called");
+       ok($matched, "$test: matched");
+       is($obj->{left}, "topic", "$test: left");
+       is($obj->{right}, "string value of obj", "$test: right");
+       ok($obj->{reversed}, "$test: reversed");
     }
+
+    {
+       my $test = "Overloaded obj in when (false)";
+       my $obj = OverloadTest->new(0);
+       my $matched;
+       given("topic") {
+           when ($obj) {$matched = 1}
+           default {$matched = 0}
+       }
     
-    is($obj->{called}, 1, "$test: called");
-    ok(!$matched, "$test: not matched");
-    is($obj->{left}, "topic", "$test: left");
-    is($obj->{right}, "string value of obj", "$test: right");
-    ok($obj->{reversed}, "$test: reversed");
+       is($obj->{called}, 1, "$test: called");
+       ok(!$matched, "$test: not matched");
+       is($obj->{left}, "topic", "$test: left");
+       is($obj->{right}, "string value of obj", "$test: right");
+       ok($obj->{reversed}, "$test: reversed");
+    }
 }
-
 # Okay, that'll do for now. The intricacies of the smartmatch
 # semantics are tested in t/op/smartmatch.t
 __END__
End of Patch.

Reply via email to