Add a test file for throw_error()
gfx [Mon, 21 Sep 2009 02:14:30 +0000 (11:14 +0900)]
t/051_throw_error.t [new file with mode: 0755]

diff --git a/t/051_throw_error.t b/t/051_throw_error.t
new file mode 100755 (executable)
index 0000000..ffa3897
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More tests => 4;
+use Test::Exception;
+
+{
+    package Role;
+    use Mouse::Role;
+
+    sub rmethod{
+        $_[0]->meta->throw_error('bar');
+    }
+
+    package Class;
+    use Mouse;
+
+    with 'Role';
+
+    sub cmethod{
+        $_[0]->meta->throw_error('foo');
+    }
+}
+
+
+throws_ok {
+    Class->new->cmethod();
+} qr/\b foo \b/xms;
+
+throws_ok {
+    Class->cmethod();
+} qr/\b foo \b/xms;
+
+
+
+throws_ok {
+    Class->new->rmethod();
+} qr/\b bar \b/xms;
+
+throws_ok {
+    Class->rmethod();
+} qr/\b bar \b/xms;
+