#!/usr/bin/perl
BEGIN { $^H{
"t::pieces/permit"
} = 1; }
my
$ret
;
{
$ret
= piecearithexpr
"a term"
;
is(
$ret
,
"(a term)"
,
'a single term'
);
}
{
$ret
= piecearithexpr
"x"
.
"y"
;
is(
$ret
,
"(xy)"
,
'arithexpr consumes concat'
);
}
{
$ret
=
join
""
,
"x"
, piecearithexpr
"inside"
,
"y"
;
is(
$ret
,
"x(inside)y"
,
'arithexpr stops before comma'
);
}
{
$ret
= piecearithexpr(
"x"
) .
"y"
;
is(
$ret
,
"(x)y"
,
'arithexpr treats (PARENS) as entire expression'
);
}
{
my
$ret1
= piecearithexpr_opt
"term"
;
my
$ret2
= piecearithexpr_opt;
is(
$ret1
,
"(term)"
,
'optional arithexpr with value'
);
is(
$ret2
,
undef
,
'optional arithexpr empty'
);
}
done_testing;