#!perl -T
{
sub
new {
bless
{
say
=>
$_
[1] },
$_
[0] }
sub
shout {
uc
$_
[0]->{
say
} }
}
-emulate
=>
'q'
,
-with
=>
sub
($) { MockShout->new(
$_
[0]) },
};
my
$t
= qObj(snafu);
is
$t
->shout,
'SNAFU'
,
'scalar method method call works'
;
is(
(qObj(hunky dory))->shout,
'HUNKY DORY'
,
'parenthesising method call works'
);
-parser
=> 1,
-emulate
=>
'q'
,
-with
=>
sub
($) { MockShout->new(
$_
[0]) },
};
is(
qObj2/foo bar baz/->shout,
'FOO BAR BAZ'
,
"Parser works with same delimiter (/)"
);
is(
qObj2(i like brackets)->shout,
'I LIKE BRACKETS'
,
"Parser works with brackets ()"
);
is(
qObj2{i like braces}->shout,
'I LIKE BRACES'
,
"Parser works with braces {}"
);