Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 900_mouse_bugs / 011_RT61852.t
CommitLineData
7e030e45 1#!perl
2# https://rt.cpan.org/Public/Bug/Display.html?id=61852
3use strict;
4use warnings;
5use Test::More;
6{
7 package X;
8 use Mouse;
9 use Mouse::Util::TypeConstraints;
10
11 subtype 'List'
12 => as 'ArrayRef[Any]'
13 => where {
14 foreach my $item(@{$_}) {
15 defined($item) or return 0;
16 }
17 return 1;
18 };
19
20 has 'list' => (
21 is => 'ro',
22 isa => 'List',
23 );
24}
25
26eval { X->new(list => [ 1, 2, 3 ]) };
27is $@, '';
28
29eval { X->new(list => [ 1, undef, 3 ]) };
30like $@, qr/Validation[ ]failed[ ]for[ ]'List'/xms;
31done_testing;