hLike doesn't have a coercion");
ok(HashLike->is_parameterizable, "HashLike is parameterizable");
isnt(HashLike->type_default, undef, "HashLike has a type_default");
is_deeply(HashLike->type_default->
rcion, "Int doesn't have a coercion");
ok(!Int->is_parameterizable, "Int isn't parameterizable");
isnt(Int->type_default, undef, "Int has a type_default");
is(Int->type_default->(), 0, "Int type_defau
doesn't have a coercion");
ok(!RegexpRef->is_parameterizable, "RegexpRef isn't parameterizable");
isnt(RegexpRef->type_default, undef, "RegexpRef has a type_default");
is( '' . RegexpRef->type_default
doesn't have a coercion");
ok(!StrictNum->is_parameterizable, "StrictNum isn't parameterizable");
isnt(StrictNum->type_default, undef, "StrictNum has a type_default");
is(StrictNum->type_default->(),
Range doesn't have a coercion");
ok(IntRange->is_parameterizable, "IntRange is parameterizable");
isnt(IntRange->type_default, undef, "IntRange has a type_default");
is(IntRange->type_default->(), 0,
Ref doesn't have a coercion");
ok(!CodeRef->is_parameterizable, "CodeRef isn't parameterizable");
isnt(CodeRef->type_default, undef, "CodeRef has a type_default");
is(scalar CodeRef->type_default->()-
as_coercion, "Bool has a coercion");
ok(!Bool->is_parameterizable, "Bool isn't parameterizable");
isnt(Bool->type_default, undef, "Bool has a type_default");
is(Bool->type_default->(), !!0, "Bool type
oercion");
ok(!PositiveOrZeroNum->is_parameterizable, "PositiveOrZeroNum isn't parameterizable");
isnt(PositiveOrZeroNum->type_default, undef, "PositiveOrZeroNum has a type_default");
is(PositiveOrZer
oercion");
ok(!PositiveOrZeroInt->is_parameterizable, "PositiveOrZeroInt isn't parameterizable");
isnt(PositiveOrZeroInt->type_default, undef, "PositiveOrZeroInt has a type_default");
is(PositiveOrZer
rcion, "Str doesn't have a coercion");
ok(!Str->is_parameterizable, "Str isn't parameterizable");
isnt(Str->type_default, undef, "Str has a type_default");
is(Str->type_default->(), '', "Str type_defa
"Undef doesn't have a coercion");
ok(!Undef->is_parameterizable, "Undef isn't parameterizable");
isnt(Undef->type_default, undef, "Undef has a type_default");
is(Undef->type_default->(), undef, "Unde
oercion");
ok(!NegativeOrZeroNum->is_parameterizable, "NegativeOrZeroNum isn't parameterizable");
isnt(NegativeOrZeroNum->type_default, undef, "NegativeOrZeroNum has a type_default");
is(NegativeOrZer
doesn't have a coercion");
ok(!SimpleStr->is_parameterizable, "SimpleStr isn't parameterizable");
isnt(SimpleStr->type_default, undef, "SimpleStr has a type_default");
is(SimpleStr->type_default->(),
ist doesn't have a coercion");
ok(!OptList->is_parameterizable, "OptList isn't parameterizable");
isnt(OptList->type_default, undef, "OptList has a type_default");
is_deeply(OptList->type_default->(),
type constraints should pass or coerce',
);
},
undef,
'... neither raise an exception',
);
isnt(
exception { xyz(2.1,3,4) },
undef,
'failed type constraint with no coercion raises an excepti
gth doesn't have a coercion");
ok(StrLength->is_parameterizable, "StrLength is parameterizable");
isnt(StrLength->type_default, undef, "StrLength has a type_default");
is(StrLength->type_default->(),
et_coderef->() );
should_fail( { foo => 1, bar => { quux => 2.1 } }, MyTypes->get_coderef->() );
isnt( MyTypes->get_coderef, \&MyTypes::MyHashRef, 'coderef got redefined' );
note( MyTypes->get_tmp->
=> "Local::A" }),
class_type({ class => "Local::B" }),
class_type({ class => "Local::C" }),
];
isnt(
exception { push @{ $c2 }, 'quux' },
undef,
'cannot push to overloaded arrayref'
);
ok(
$c2
IN' );
is( $out, 'OUT' );
is_deeply( $slurpy, [ 'FOO', 'BAR' ] );
my $sig2;
my $e = exception {
$sig2 = signature pos => [ Int, { slurpy => 1 } ];
$sig2->( 42 );
};
isnt $e, undef;
done_testing;
($arr)]->[0] ),
refaddr($arr),
'if value passes type constraint; no need to clone arrayref'
);
isnt(
refaddr( [$chk2->($arr2)]->[0] ),
refaddr($arr2),
'if value fails type constraint; need to cl