Add a test for wrapping a method which doesn't exist.
Dave Rolsky [Fri, 20 Feb 2009 18:23:12 +0000 (18:23 +0000)]
t/017_add_method_modifier.t

index 753e2ca..c116c0b 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 19;
+use Test::More tests => 20;
 use Test::Exception;
 
 use Class::MOP;
@@ -65,6 +65,14 @@ use Class::MOP;
         }
     );
 
+    ::throws_ok(
+        sub {
+            CheckingAccount->meta->add_before_method_modifier(
+                'does_not_exist' => sub { } );
+        },
+        qr/\QThe method 'does_not_exist' was not found in the inheritance hierarchy for CheckingAccount/
+    );
+
     ::ok( CheckingAccount->meta->has_method('withdraw'),
         '... checking account now has a withdraw method' );
     ::isa_ok( CheckingAccount->meta->get_method('withdraw'),