fix error propagation when creating broken method modifiers
[gitmo/Role-Tiny.git] / t / role-tiny.t
index fdc23fd..db84ada 100644 (file)
@@ -61,6 +61,13 @@ BEGIN {
   sub extra1 { 'role extra' }
 }
 
+BEGIN {
+  package BrokenRole;
+  use Role::Tiny;
+
+  around 'broken modifier' => sub { my $orig = shift; $orig->(@_) };
+}
+
 sub try_apply_to {
   my $to = shift;
   exception { Role::Tiny->apply_role_to_package($to, 'MyRole') }
@@ -95,5 +102,9 @@ is exception {
 isa_ok($new_class, 'MyClass');
 is($new_class->extra1, 'role extra', 'method from role');
 
+ok(exception {
+    $new_class = Role::Tiny->create_class_with_roles('MyClass', 'BrokenRole');
+}, 'exception caught creating class with broken modifier in a role');
+
 done_testing;