6 use Test::More tests => 6;
8 use constant Str => 'MyTypes::Str';
9 use constant Int => 'MyTypes::Int';
10 use constant Num => 'MyTypes::Num';
12 sub MyTypes::Str::new { "str:$_[0]" }
14 sub MyTypes::Int::new { "int:$_[0]" }
16 { package MyTypes::Num }
19 use Lexical::Types as => sub { $_[0] =~ /(?:Str|Int)/ ? ($_[0], 'new') : () };
22 is $x, "str:MyTypes::Str", 'my constant_type $x';
25 is $y, "int:MyTypes::Int", 'my constant_type ($y,';
26 is $z, "int:MyTypes::Int", 'my constant_type $z)';
29 is $t, undef, 'my constant_type_skipped $t';
32 is $u, "str:MyTypes::Str", 'my MyTypes::Str $u';
35 is $v, undef, 'my MyTypes::Num $v';