b85c17162658a248ce19ef1f564615a8a836cced
[gitmo/Moose.git] / t / 020_attributes / 034_bad_coerce.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 BEGIN {
6     eval "use Test::Output;";
7     plan skip_all => "Test::Output is required for this test" if $@;
8 }
9
10 {
11     package Foo;
12
13     use Moose;
14
15     ::stderr_like{ has foo => (
16             is     => 'ro',
17             isa    => 'Str',
18             coerce => 1,
19         );
20         }
21         qr/\QYou cannot coerce an attribute (foo) unless its type (Str) has a coercion/,
22         'Cannot coerce unless the type has a coercion';
23 }
24
25 done_testing;