We only need local $? if we inline calls to DEMOLISH
[gitmo/Moose.git] / t / attributes / bad_coerce.t
CommitLineData
2b54d2a6 1use strict;
2use warnings;
3
4use Test::More;
4d438a84 5
6use Test::Requires {
7 'Test::Output' => '0.01', # skip all if not installed
8};
2b54d2a6 9
10{
11 package Foo;
12
13 use Moose;
14
f1309155 15 ::stderr_like{ has foo => (
2b54d2a6 16 is => 'ro',
17 isa => 'Str',
18 coerce => 1,
19 );
f1309155 20 }
21 qr/\QYou cannot coerce an attribute (foo) unless its type (Str) has a coercion/,
2b54d2a6 22 'Cannot coerce unless the type has a coercion';
5f8991ed 23
24 ::stderr_like{ has bar => (
25 is => 'ro',
26 isa => 'Str',
27 coerce => 1,
28 );
29 }
30 qr/\QYou cannot coerce an attribute (bar) unless its type (Str) has a coercion/,
31 'Cannot coerce unless the type has a coercion - different attribute';
2b54d2a6 32}
33
34done_testing;