Support is => 'bare' for compatibility
[gitmo/Mouse.git] / t / 000-recipes / 001_point.t
index 9fb061e..90b989b 100644 (file)
@@ -3,13 +3,19 @@
 use strict;
 use warnings;
 
-use Test::More tests => 58;
-use Mouse::Util ':test';
-
+use Test::More;
 BEGIN {
-    use_ok('Mouse');           
+    if (eval "require Class::Method::Modifiers; 1") {
+        plan tests => 59;
+    }
+    else {
+        plan skip_all => "Class::Method::Modifiers required for this test";
+    }
 }
 
+use Mouse::Util;
+use Test::Exception;
+
 {
        package Point;  
        use Mouse;
@@ -23,19 +29,21 @@ BEGIN {
            $self->y(0);    
        }
        
+    __PACKAGE__->meta->make_immutable();
 }{     
        package Point3D;
        use Mouse;
        
        extends 'Point';
        
-       has 'z' => (isa => 'Int');
+       has 'z' => (isa => 'Int', is => 'bare');
        
        after 'clear' => sub {
            my $self = shift;
            $self->{z} = 0;
        };
        
+    __PACKAGE__->meta->make_immutable();
 }
 
 my $point = Point->new(x => 1, y => 2);        
@@ -126,16 +134,16 @@ is_deeply(
        [ 'Mouse::Object' ],
        '... Point got the automagic base class');
 
-my @Point_methods = qw(meta new x y clear);
+my @Point_methods = qw(meta new x y clear DESTROY);
 my @Point_attrs   = ('x', 'y');
 
-SKIP: {
-    skip "Mouse has no method introspection", 2 + @Point_methods;
+is_deeply(
+    [ sort @Point_methods                 ],
+    [ sort Point->meta->get_method_list() ],
+    '... we match the method list for Point');
 
-    is_deeply(
-        [ sort @Point_methods                 ],
-        [ sort Point->meta->get_method_list() ],
-        '... we match the method list for Point');
+SKIP: {
+    skip "Mouse has no method introspection", 1 + @Point_methods;
         
     is_deeply(
         [ sort @Point_attrs                      ],
@@ -166,7 +174,7 @@ is_deeply(
        [ 'Point' ],
        '... Point3D gets the parent given to it');
 
-my @Point3D_methods = qw(new meta clear);
+my @Point3D_methods = qw(new meta clear DESTROY);
 my @Point3D_attrs   = ('z');
 
 SKIP: {