From: Adam J. Foxson Date: Mon, 30 Jun 2008 17:33:06 +0000 (+0000) Subject: In the case where a child type constraint's parent constraint fails, the exception... X-Git-Tag: 0_55~65 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d5f58e3e5d1326ce5975931df464b36eb5d1b61;p=gitmo%2FMoose.git In the case where a child type constraint's parent constraint fails, the exception should reference the parent type constraint that actually failed instead of always referencing the child'd type constraint. --- diff --git a/t/600_todo_tests/001_exception_reflects_failed_constraint.t b/t/600_todo_tests/001_exception_reflects_failed_constraint.t new file mode 100644 index 0000000..db7fe69 --- /dev/null +++ b/t/600_todo_tests/001_exception_reflects_failed_constraint.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +# In the case where a child type constraint's parent constraint fails, +# the exception should reference the parent type constraint that actually +# failed instead of always referencing the child'd type constraint + +use strict; +use warnings; + +use Test::More tests => 4; +use Test::Exception; + +BEGIN { + use_ok('Moose::Util::TypeConstraints'); +} + +lives_ok { + subtype 'ParentConstraint' => as 'Str' => where {0}; +} 'specified parent type constraint'; + +my $tc; +lives_ok { + $tc = subtype 'ChildConstraint' => as 'ParentConstraint' => where {1}; +} 'specified child type constraint'; + +{ + my $errmsg = $tc->validate(); + + TODO: { + local $TODO = 'Not yet supported'; + ok($errmsg !~ /Validation failed for 'ChildConstraint'/, 'exception references failing parent constraint'); + }; +}