Basic test for meta_lookup
[gitmo/Moose.git] / t / todo_tests / exception_reflects_failed_constraint.t
1 #!/usr/bin/perl
2
3 # In the case where a child type constraint's parent constraint fails,
4 # the exception should reference the parent type constraint that actually
5 # failed instead of always referencing the child'd type constraint
6
7 use strict;
8 use warnings;
9
10 use Test::More;
11 use Test::Fatal;
12
13 BEGIN {
14     use_ok('Moose::Util::TypeConstraints');
15 }
16
17 is( exception {
18     subtype 'ParentConstraint' => as 'Str' => where {0};
19 }, undef, 'specified parent type constraint' );
20
21 my $tc;
22 is( exception {
23     $tc = subtype 'ChildConstraint' => as 'ParentConstraint' => where {1};
24 }, undef, 'specified child type constraint' );
25
26 {
27     my $errmsg = $tc->validate();
28
29     TODO: {
30         local $TODO = 'Not yet supported';
31         ok($errmsg !~ /Validation failed for 'ChildConstraint'/, 'exception references failing parent constraint');
32     };
33 }
34
35 done_testing;