Release commit for 1.003003
[gitmo/Role-Tiny.git] / t / compose-modifiers.t
index 0dde333..20658b6 100644 (file)
@@ -16,7 +16,7 @@ BEGIN {
   around foo => sub { my $orig = shift; (__PACKAGE__, $orig->(@_)) };
   package Four; use Role::Tiny;
   around foo => sub { my $orig = shift; (__PACKAGE__, $orig->(@_)) };
-  package Base; sub foo { __PACKAGE__ }
+  package BaseClass; sub foo { __PACKAGE__ }
 }
 
 foreach my $combo (
@@ -24,12 +24,12 @@ foreach my $combo (
   [ qw(Two Four Three) ],
   [ qw(One Two) ]
 ) {
-  my $combined = Role::Tiny->create_class_with_roles('Base', @$combo);
+  my $combined = Role::Tiny->create_class_with_roles('BaseClass', @$combo);
   is_deeply(
-    [ $combined->foo ], [ reverse(@$combo), 'Base' ],
+    [ $combined->foo ], [ reverse(@$combo), 'BaseClass' ],
     "${combined} ok"
   );
-  my $object = bless({}, 'Base');
+  my $object = bless({}, 'BaseClass');
   Role::Tiny->apply_roles_to_object($object, @$combo);
   is(ref($object), $combined, 'Object reblessed into correct class');
 }
@@ -43,12 +43,20 @@ foreach my $combo (
   is eval {
     package WithFive;
     use Role::Tiny::With;
-    use base 'Base';
+    use base 'BaseClass';
     with 'Five';
   }, undef,
     "composing an around modifier fails when method doesn't exist";
   like $@, qr/Can't apply Five to WithFive - missing bar/,
     ' ... with correct error message';
 }
+{
+  is eval {
+    Role::Tiny->create_class_with_roles('BaseClass', 'Five');
+  }, undef,
+    "composing an around modifier fails when method doesn't exist";
+  like $@, qr/Can't apply Five to .* - missing bar/,
+    ' ... with correct error message';
+}
 
 done_testing;