Add test for error message from bad handles value with native traits (RT #69990)
[gitmo/Moose.git] / t / todo_tests / exception_reflects_failed_constraint.t
CommitLineData
4d5f58e3 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
7use strict;
8use warnings;
9
a28e50e4 10use Test::More;
b10dde3a 11use Test::Fatal;
4d5f58e3 12
13BEGIN {
9978e85e 14 use_ok('Moose::Util::TypeConstraints');
4d5f58e3 15}
16
b10dde3a 17is( exception {
9978e85e 18 subtype 'ParentConstraint' => as 'Str' => where {0};
b10dde3a 19}, undef, 'specified parent type constraint' );
4d5f58e3 20
21my $tc;
b10dde3a 22is( exception {
9978e85e 23 $tc = subtype 'ChildConstraint' => as 'ParentConstraint' => where {1};
b10dde3a 24}, undef, 'specified child type constraint' );
4d5f58e3 25
26{
9978e85e 27 my $errmsg = $tc->validate();
4d5f58e3 28
9978e85e 29 TODO: {
30 local $TODO = 'Not yet supported';
31 ok($errmsg !~ /Validation failed for 'ChildConstraint'/, 'exception references failing parent constraint');
32 };
4d5f58e3 33}
a28e50e4 34
35done_testing;