Commit | Line | Data |
---|---|---|
f6f646d5 | 1 | use strictures 1; |
2 | use Test::More; | |
09233107 | 3 | use Test::Fatal; |
f6f646d5 | 4 | |
5 | { | |
6 | package Foo; | |
7 | use Moo; | |
8 | ||
9 | has bar => ( is => "rw" ); | |
10 | has baz => ( is => "rw" ); | |
11 | ||
12 | sub BUILDARGS { | |
13 | my ($self, $args) = @_; | |
14 | ||
15 | return %$args | |
16 | } | |
17 | } | |
18 | ||
09233107 | 19 | like( |
20 | exception { Foo->new({ bar => 1, baz => 1 }) }, | |
21 | qr/BUILDARGS did not return a hashref/, | |
22 | 'Sensible error message' | |
23 | ); | |
f6f646d5 | 24 | |
25 | done_testing; | |
26 |