s retains order',
);
is_deeply(
[@{ +FBB }],
[qw/foo bar baz/],
'overload retains order',
);
isnt(
exception { push @{ +FBB }, 'quux' },
undef,
'cannot push to overloaded arrayref'
);
use Sca
nt->create_child_type()];
is($p1->{uniq}, $p2->{uniq}, "Avoid duplicating parameterized types");
isnt($p1->{uniq}, $p3->{uniq}, "... except when necessary!");
my $p4 = ArrayRef[sub { $_ eq "Bob" }];
obj->foo, 12, 'write then read on accessor works');
my $e = exception {
local $Object::Accessor::FATAL = 1;
$obj->foo("Hello");
};
isnt($e, undef, 'exception thrown for bad value');
done_testing;
arameters qw(:strict);
fun foo ((Int) $x)
{
return $x;
}
is(
foo(4),
4,
'foo(4) works',
);
isnt(
exception { foo(4.1) },
undef,
'foo(4.1) throws',
);
my $info = Function::Parameters::info(\
_inlined");
should_pass(2, $SmallEven);
should_fail(20, $SmallEven);
should_fail(3, $SmallEven);
isnt(
exception { push @{ $SmallEven }, 'quux' },
undef,
'cannot push to overloaded arrayref'
);
d
undef $inline_assert;
my $e = exception {
$inline_assert = $type->inline_assert('$VALUE[0]');
};
isnt($e, undef, 'cannot be done!');
note("INLINE ASSERTION, NON-INLINABLE TYPE, WITH TYPEVAR");
note(
oercion");
ok(!NegativeOrZeroInt->is_parameterizable, "NegativeOrZeroInt isn't parameterizable");
isnt(NegativeOrZeroInt->type_default, undef, "NegativeOrZeroInt has a type_default");
is(NegativeOrZer
esn't have a coercion");
ok(!StringLike->is_parameterizable, "StringLike isn't parameterizable");
isnt(StringLike->type_default, undef, "StringLike has a type_default");
is(StringLike->type_default->(
ired for further testing";
done_testing;
exit(0);
};
my $coderef3 = $type->_overload_coderef;
isnt($coderef3, $coderef1, 'loading Sub::Quote triggers rebuilding overload coderef');
my $coderef4 =
Ref doesn't have a coercion");
ok(ScalarRef->is_parameterizable, "ScalarRef is parameterizable");
isnt(ScalarRef->type_default, undef, "ScalarRef has a type_default");
is_deeply(ScalarRef->type_defaul
Range doesn't have a coercion");
ok(NumRange->is_parameterizable, "NumRange is parameterizable");
isnt(NumRange->type_default, undef, "NumRange has a type_default");
is(NumRange->type_default->(), 0,
Match doesn't have a coercion");
ok(StrMatch->is_parameterizable, "StrMatch is parameterizable");
isnt(StrMatch->type_default, undef, "StrMatch has a type_default");
is(StrMatch->type_default->(), '',
rcion, "Num doesn't have a coercion");
ok(!Num->is_parameterizable, "Num isn't parameterizable");
isnt(Num->type_default, undef, "Num has a type_default");
is(Num->type_default->(), 0, "Num type_defau
axNum doesn't have a coercion");
ok(!LaxNum->is_parameterizable, "LaxNum isn't parameterizable");
isnt(LaxNum->type_default, undef, "LaxNum has a type_default");
is(LaxNum->type_default->(), 0, "LaxNu
rcion, "Any doesn't have a coercion");
ok(!Any->is_parameterizable, "Any isn't parameterizable");
isnt(Any->type_default, undef, "Any has a type_default");
is(Any->type_default->(), undef, "Any type_d
ike doesn't have a coercion");
ok(ArrayLike->is_parameterizable, "ArrayLike is parameterizable");
isnt(ArrayLike->type_default, undef, "ArrayLike has a type_default");
is_deeply(ArrayLike->type_defaul
"BoolLike has no coercion");
ok(!BoolLike->is_parameterizable, "BoolLike isn't parameterizable");
isnt(BoolLike->type_default, undef, "BoolLike has a type_default");
is(BoolLike->type_default->(), !!0
n't have a coercion");
ok(!SingleDigit->is_parameterizable, "SingleDigit isn't parameterizable");
isnt(SingleDigit->type_default, undef, "SingleDigit has a type_default");
is(SingleDigit->type_default