summaryrefslogtreecommitdiff
path: root/t/basics/error_handling.t
blob: 250aa3036ea6fad70c77d51d37278c2f0e7c625c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;