summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorToby Inkster <mail@tobyinkster.co.uk>2014-08-18 11:33:08 +0100
committerToby Inkster <mail@tobyinkster.co.uk>2014-08-18 11:33:08 +0100
commitfcc4bdaf7dc2d228550657dc1035c93d8ca65fbb (patch)
tree9980ce1bb27b0f23e5a8f7bab54a0e215e1f4d4d /t
parente436e60abb272906af6de116c3cb20b62eabace4 (diff)
bug in Type::Utils 1.000000; fixed in 1.000001
Diffstat (limited to 't')
-rw-r--r--t/05haveimissedanytypes.t21
1 files changed, 18 insertions, 3 deletions
diff --git a/t/05haveimissedanytypes.t b/t/05haveimissedanytypes.t
index 53c5d20..963d6cb 100644
--- a/t/05haveimissedanytypes.t
+++ b/t/05haveimissedanytypes.t
@@ -64,7 +64,11 @@ my @class_types_to_check = qw(
my $count = 0;
sub constraint_for
{
- my $type = shift;
+ my $type = shift;
+
+ # Note that this will cause Local::Test1 to exist.
+ # We later use that in a @class_types_to_check test.
+ #
my $class = "Local::Test" . ++$count;
eval qq{
@@ -73,7 +77,7 @@ sub constraint_for
use MooX::late;
has attr => (is => "ro", isa => "$type");
1;
- } or die $@;
+ } or diag($@);
"Moo"->_constructor_maker_for($class)->all_attribute_specs->{attr}{isa};
}
@@ -89,7 +93,18 @@ for my $type (@class_types_to_check)
{
my $got = constraint_for($type);
isa_ok($got, "Type::Tiny::Class", "constraint_for('$type')");
- is($got->class, $type, "Type constraint returned for '$type' looks right.");
+ is($got && $got->class, $type, "Type constraint returned for '$type' looks right.");
+}
+
+{
+ my $type = 'ArrayRef[Local::Test1]';
+ my $got = constraint_for($type);
+ isa_ok($got, "Type::Tiny", "constraint_for('$type')");
+ is(
+ $got && $got->type_parameter && $got->type_parameter->class,
+ "Local::Test1",
+ "Type constraint returned for '$type' looks right"
+ );
}
done_testing;