overload.t: Move some tests above ‘keep last’ test
authorFather Chrysostomos <sprout@cpan.org>
Fri, 18 May 2012 20:37:40 +0000 (13:37 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 22 May 2012 01:09:27 +0000 (18:09 -0700)
lib/overload.t

index a10fd4e..6efbf0f 100644 (file)
@@ -2201,38 +2201,6 @@ fresh_perl_is
       'Error message when sub stub is encountered';
 }
 
-sub eleventative::cos { 'eleven' }
-sub twelvetative::abs { 'twelve' }
-sub thirteentative::abs { 'thirteen' }
-sub fourteentative::abs { 'fourteen' }
-@eleventative::ISA = twelvetative::;
-{
-    my $o = bless [], 'eleventative';
-    eval 'package eleventative; use overload map +($_)x2, cos=>abs=>';
-    is cos $o, 'eleven', 'overloading applies to object blessed before';
-    bless [], 'eleventative';
-    is cos $o, 'eleven',
-      'ovrld applies to previously-blessed obj after other obj is blessed';
-    $o = bless [], 'eleventative';
-    *eleventative::cos = sub { 'ten' };
-    is cos $o, 'ten', 'method changes affect overloading';
-    @eleventative::ISA = thirteentative::;
-    is abs $o, 'thirteen', 'isa changes affect overloading';
-    bless $o, 'fourteentative';
-    @fourteentative::ISA = 'eleventative';
-    local our $TODO = '[perl #112708]';
-    is abs $o, 'fourteen', 'isa changes can turn overloading on';
-}
-
-{ # undefining the overload stash -- KEEP THIS TEST LAST
-    package ant;
-    use overload '+' => 'onion';
-    $_ = \&overload::nil;
-    undef %overload::;
-    bless[];
-    ::ok(1, 'no crash when undefining %overload::');
-}
-
 # [perl #40333]
 # overload::Overloaded should not use a ->can designed for autoloading.
 # This example attempts to be as realistic as possible.  The o class has a
@@ -2267,5 +2235,37 @@ ok !overload::Overloaded(new proxy new o),
     ok(overload::Overloaded($obj));
 }
 
+sub eleventative::cos { 'eleven' }
+sub twelvetative::abs { 'twelve' }
+sub thirteentative::abs { 'thirteen' }
+sub fourteentative::abs { 'fourteen' }
+@eleventative::ISA = twelvetative::;
+{
+    my $o = bless [], 'eleventative';
+    eval 'package eleventative; use overload map +($_)x2, cos=>abs=>';
+    is cos $o, 'eleven', 'overloading applies to object blessed before';
+    bless [], 'eleventative';
+    is cos $o, 'eleven',
+      'ovrld applies to previously-blessed obj after other obj is blessed';
+    $o = bless [], 'eleventative';
+    *eleventative::cos = sub { 'ten' };
+    is cos $o, 'ten', 'method changes affect overloading';
+    @eleventative::ISA = thirteentative::;
+    is abs $o, 'thirteen', 'isa changes affect overloading';
+    bless $o, 'fourteentative';
+    @fourteentative::ISA = 'eleventative';
+    local our $TODO = '[perl #112708]';
+    is abs $o, 'fourteen', 'isa changes can turn overloading on';
+}
+
+{ # undefining the overload stash -- KEEP THIS TEST LAST
+    package ant;
+    use overload '+' => 'onion';
+    $_ = \&overload::nil;
+    undef %overload::;
+    bless[];
+    ::ok(1, 'no crash when undefining %overload::');
+}
+
 
 # EOF