6df64defda99fb6caf176369ba208a66d2888e3c
[gitmo/Mouse.git] / t / 020_attributes / 034_bad_coerce.t
1 use strict;
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5 use warnings;
6
7 use Test::More;
8
9 use Test::Requires {
10     'Test::Output' => '0.01', # skip all if not installed
11 };
12
13 {
14     package Foo;
15
16     use Mouse;
17
18     ::stderr_like{ has foo => (
19             is     => 'ro',
20             isa    => 'Str',
21             coerce => 1,
22         );
23         }
24         qr/\QYou cannot coerce an attribute (foo) unless its type (Str) has a coercion/,
25         'Cannot coerce unless the type has a coercion';
26
27     ::stderr_like{ has bar => (
28             is     => 'ro',
29             isa    => 'Str',
30             coerce => 1,
31         );
32         }
33         qr/\QYou cannot coerce an attribute (bar) unless its type (Str) has a coercion/,
34         'Cannot coerce unless the type has a coercion - different attribute';
35 }
36
37 done_testing;