#!/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;
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');
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';
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');
[ $foo_role->get_method_modifier_list('before') ],
[ 'boo' ],
'... got the right list of before method modifiers');
-
-done_testing;