BEGIN
{
$ENV
{EXTENDED_TESTING} = 0;
{
Test::Tester->
import
(
tests
=> 48);
}
else
{
Test::More->
import
(
skip_all
=>
'requires Test::Tester'
);
}
}
check_test(
sub
{ should_pass(1, Int) },
{
ok
=> 1,
name
=>
'Value "1" passes type constraint Int'
,
diag
=>
''
,
type
=>
''
,
},
'successful should_pass'
,
);
check_test(
sub
{ should_pass([], Int) },
{
ok
=> 0,
name
=>
'Reference [] passes type constraint Int'
,
diag
=>
''
,
type
=>
''
,
},
'unsuccessful should_pass'
,
);
check_test(
sub
{ should_fail([], Int) },
{
ok
=> 1,
name
=>
'Reference [] fails type constraint Int'
,
diag
=>
''
,
type
=>
''
,
},
'successful (i.e. failing) should_fail'
,
);
check_test(
sub
{ should_fail(1, Int) },
{
ok
=> 0,
name
=>
'Value "1" fails type constraint Int'
,
diag
=>
''
,
type
=>
''
,
},
'unsuccessful (i.e. passing) should_fail'
,
);
check_test(
sub
{ ok_subtype(Num, Int) },
{
ok
=> 1,
name
=>
'Num subtype: Int'
,
diag
=>
''
,
type
=>
''
,
},
'successful ok_subtype'
,
);
check_test(
sub
{ ok_subtype(Int, Num) },
{
ok
=> 0,
name
=>
'Int subtype: Num'
,
diag
=>
''
,
type
=>
''
,
},
'unsuccessful ok_subtype'
,
);