use
lib
qw( ./lib ./t/lib ../inc ./inc )
;
my
$type
= Int->create_child_type;
$type
->coercion->add_type_coercions( Num,
q[int($_)]
);
like(
exception {
$type
->coercion->meta },
qr/^Not really a Moose::Meta::TypeCoercion/
,
'$type->coercion->meta'
,
);
$type
->coercion->_compiled_type_coercion(
Type::Coercion->new(
type_coercion_map
=> [ ArrayRef,
q[666]
],
),
);
$type
->coercion->_compiled_type_coercion(
sub
{ 999 },
);
is(
$type
->coerce(3.1), 3,
'$type->coercion->add_type_coercions(TYPE, STR)'
);
is(
$type
->coerce([]), 666,
'$type->coercion->_compiled_type_coercion(OBJECT)'
);
is(
$type
->coerce(
undef
), 999,
'$type->coercion->_compiled_type_coercion(CODE)'
);
my
$J
= Types::Standard::Join;
is(
"$J"
,
'Join'
);
like(
$J
->_stringify_no_magic,
qr/^Type::Coercion=HASH\(0x[0-9a-f]+\)$/
i);
done_testing;