Add tests
Fuji, Goro [Thu, 28 Oct 2010 12:50:43 +0000 (21:50 +0900)]
t/001_mouse/070-inherit-role-attr.t [new file with mode: 0644]

diff --git a/t/001_mouse/070-inherit-role-attr.t b/t/001_mouse/070-inherit-role-attr.t
new file mode 100644 (file)
index 0000000..ba46a3f
--- /dev/null
@@ -0,0 +1,31 @@
+#!perl -w
+use strict;
+use Test::More;
+{
+    package Role;
+    use Mouse::Role;
+
+    has foo => (
+        is       => 'bare',
+        init_arg => undef,
+    );
+
+    package Class;
+    use Mouse;
+    with 'Role';
+
+    has "+foo" => (
+        default => 'bar',
+    );
+
+    ::ok( __PACKAGE__->meta->find_attribute_by_name('foo')->has_default );
+}
+
+my $foo = Class->meta->get_attribute('foo');
+ok $foo;
+is $foo->name, 'foo';
+is $foo->init_arg, undef;
+is $foo->default, 'bar';
+
+done_testing;
+