Failing test from ether
Dave Rolsky [Mon, 14 Feb 2011 03:29:13 +0000 (21:29 -0600)]
t/11-strict-role-composition.t [new file with mode: 0644]

diff --git a/t/11-strict-role-composition.t b/t/11-strict-role-composition.t
new file mode 100644 (file)
index 0000000..3e5cd8c
--- /dev/null
@@ -0,0 +1,51 @@
+# Reported as https://rt.cpan.org/Public/Bug/Display.html?id=59663
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+use Test::Fatal;
+
+use Test::Requires {
+    'MooseX::Role::Strict' => 0.01,
+};
+
+{
+    package Role;
+
+    use MooseX::Role::Strict;
+    use MooseX::ClassAttribute;
+
+    class_has attr => (
+        is      => 'ro',
+        isa     => 'HashRef[Str]',
+        lazy    => 1,
+        default => sub { {} },
+        traits  => ['Hash'],
+        handles => {
+            has_attr => 'exists',
+        },
+    );
+
+    sub normal_method {
+        Test::More::pass('a regular method from the role is composed');
+    }
+
+}
+
+{
+    package Foo;
+    use Moose;
+
+    with 'Role';
+}
+
+use Test::NoWarnings;
+
+Foo->normal_method();
+
+is(
+    exception { Foo->has_attr('key') }, undef,
+    'Delegated method from native attribute trait is properly composed from a strict role'
+);
+