Add test for error message from bad handles value with native traits (RT #69990)
Dave Rolsky [Thu, 1 Sep 2011 14:52:30 +0000 (09:52 -0500)]
t/bugs/native_trait_handles_bad_value.t [new file with mode: 0644]

diff --git a/t/bugs/native_trait_handles_bad_value.t b/t/bugs/native_trait_handles_bad_value.t
new file mode 100644 (file)
index 0000000..34824aa
--- /dev/null
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Fatal;
+
+{
+
+    package Bug;
+    use Moose;
+
+    ::like(
+        ::exception{ has member => (
+                is      => 'ro',
+                isa     => 'HashRef',
+                traits  => ['Hash'],
+                handles => {
+                    method => sub { }
+                },
+            );
+            },
+        qr/\QAll values passed to handles must be strings or ARRAY references, not CODE/,
+        'bad value in handles throws a useful error'
+    );
+}
+
+done_testing;