Revert autogenerated tests. Tests should not changed radically.
[gitmo/Mouse.git] / t / 030_roles / 001_meta_role.t
similarity index 76%
rename from t-failing/030_roles/001_meta_role.t
rename to t/030_roles/001_meta_role.t
index b93903f..8b642c3 100644 (file)
@@ -1,17 +1,15 @@
 #!/usr/bin/perl
-# This is automatically generated by author/import-moose-test.pl.
-# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
-use t::lib::MooseCompat;
 
 use strict;
 use warnings;
 
-use Test::More;
-$TODO = q{Mouse is not yet completed};
+use Test::More tests => 26;
 use Test::Exception;
 
+use Test::Mouse;
 use Mouse::Meta::Role;
-use Mouse::Util::TypeConstraints ();
+use lib 't/lib';
+use MooseCompat;
 
 {
     package FooRole;
@@ -23,7 +21,7 @@ use Mouse::Util::TypeConstraints ();
 
 my $foo_role = Mouse::Meta::Role->initialize('FooRole');
 isa_ok($foo_role, 'Mouse::Meta::Role');
-isa_ok($foo_role, 'Mouse::Meta::Module');
+#isa_ok($foo_role, 'Class::MOP::Module');
 
 is($foo_role->name, 'FooRole', '... got the right name of FooRole');
 is($foo_role->version, '0.01', '... got the right version of FooRole');
@@ -60,16 +58,13 @@ is_deeply(
 
 ok($foo_role->has_attribute('bar'), '... FooRole does have the bar attribute');
 
-my $bar = $foo_role->get_attribute('bar');
-is_deeply( $bar->original_options, { is => 'rw', isa => 'Foo' },
-    'original options for bar attribute' );
-my $bar_for_class = $bar->attribute_for_class('Mouse::Meta::Attribute');
-is(
-    $bar_for_class->type_constraint,
-    Mouse::Util::TypeConstraints::class_type('Foo'),
-    'bar has a Foo class type'
-);
-
+{
+    local $TODO = 'Mouse does not support role attributes';
+    is_deeply(
+        join('|', %{$foo_role->get_attribute('bar')}),
+        join('|', %{+{ is => 'rw', isa => 'Foo' }}),
+        '... got the correct description of the bar attribute');
+}
 lives_ok {
     $foo_role->add_attribute('baz' => (is => 'ro'));
 } '... added the baz attribute okay';
@@ -81,9 +76,10 @@ is_deeply(
 
 ok($foo_role->has_attribute('baz'), '... FooRole does have the baz attribute');
 
-my $baz = $foo_role->get_attribute('baz');
-is_deeply( $baz->original_options, { is => 'ro' },
-    'original options for baz attribute' );
+is_deeply(
+    $foo_role->get_attribute('baz')->{is},
+    'ro',
+    '... got the correct description of the baz attribute');
 
 lives_ok {
     $foo_role->remove_attribute('bar');
@@ -113,5 +109,3 @@ is_deeply(
     [ $foo_role->get_method_modifier_list('before') ],
     [ 'boo' ],
     '... got the right list of before method modifiers');
-
-done_testing;