Import Moose/t/010_basics/*.t
[gitmo/Mouse.git] / t / 010_basics / 017_error_handling.t
diff --git a/t/010_basics/017_error_handling.t b/t/010_basics/017_error_handling.t
new file mode 100755 (executable)
index 0000000..fee2964
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+use Test::Exception;
+
+# This tests the error handling in Mouse::Object only
+
+{
+    package Foo;
+    use Mouse;
+}
+
+throws_ok { Foo->new('bad') } qr/^\QSingle parameters to new() must be a HASH ref/,
+          'A single non-hashref arg to a constructor throws an error';
+throws_ok { Foo->new(undef) } qr/^\QSingle parameters to new() must be a HASH ref/,
+          'A single non-hashref arg to a constructor throws an error';
+
+throws_ok { Foo->does() } qr/^\QYou must supply a role name to does()/,
+          'Cannot call does() without a role name';