summaryrefslogtreecommitdiff
path: root/t/basics/error_handling.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
commit5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch)
tree298c3d2f08bdfe5689998b11892d72a897985be1 /t/basics/error_handling.t
downloadMoose-tarball-master.tar.gz
Diffstat (limited to 't/basics/error_handling.t')
-rw-r--r--t/basics/error_handling.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/basics/error_handling.t b/t/basics/error_handling.t
new file mode 100644
index 0000000..250aa30
--- /dev/null
+++ b/t/basics/error_handling.t
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Fatal;
+
+# This tests the error handling in Moose::Object only
+
+{
+ package Foo;
+ use Moose;
+}
+
+like( exception { Foo->new('bad') }, qr/^\QSingle parameters to new() must be a HASH ref/, 'A single non-hashref arg to a constructor throws an error' );
+like( exception { Foo->new(undef) }, qr/^\QSingle parameters to new() must be a HASH ref/, 'A single non-hashref arg to a constructor throws an error' );
+
+like( exception { Foo->does() }, qr/^\QYou must supply a role name to does()/, 'Cannot call does() without a role name' );
+
+done_testing;