BEGIN {
$ENV
{PERLRIG_FILE} =
$Bin
.
'/perlrig'
}
{
use
rig
'_t_perlrig_utils'
;
eval
q{
$var = 1;
}
;
like( $@,
qr/requires explicit/
,
'check strict'
);
is( sum(1..10), 55,
'sum'
);
is( max(1..10), 10,
'max'
);
is(
do
{ firstval {
$_
eq 10 } 1..20 } , 10,
'firstval'
);
ok(
do
{ any {
$_
eq 10 } 1..20 },
'any'
);
}
SKIP: {
skip
'no moose'
,2
unless
eval
'require Moose'
;
{
has
'name'
=>
is
=>
'rw'
,
isa
=>
'Str'
;
}
{
my
$obj
= TestMe->new;
is(
ref
(
$obj
),
'TestMe'
,
'moose new'
);
is(
$obj
->name(
'testing'
),
'testing'
,
'moose accessor'
);
}
}
{
is( summa1(1..10), 55,
'summa1 alias'
);
is( summa2(1..10), 55,
'summa2 alias'
);
is( maxxy(1..10), 10,
'maxxy alias'
);
ok( !
eval
'max(1..10); 1'
,
'max original delete'
);
}
{
is( sum(1..10), 55,
'sum and optional'
);
}
{
eval
q{ use rig '_t_version' }
;
ok( $@,
'version ok'
);
}
{
my
$a
=
eval
q{ timethese(1,{a=>sub{}
,
b
=>
sub
{}}); 1}
;
print
$@;
is(
$a
, 1 ,
'also'
);
}
done_testing;