$no = 'no ';
}
return ok($ok, $name);
}
sub is_flag { return _test_flag 0, @_; }
sub isnt_flag { return _test_flag 1, @_; }
sub oneliner {
my ($perl) = @_;
my ($SCRIPT, $script)
\PVBM);
my $pvbm = clone \PVBM;
isa_ok b($pvbm), $type, 'PVBM cloned';
isnt $pvbm, \PVBM, '...not a copy';
has_mg \PVBM, 'B', '(sanity
'D', '@+ loses magic';
is_deeply $Dmg, \@+, '...but keeps value';
isnt \$Dmg->[0], \$+[0], '...not copied';
has_mg \$+[0], 'd', '(sanity
my $cv = clone $sub;
isa_ok b($cv), 'B::CV', 'closure cloned';
isnt $cv, $sub, '...not copied';
is $cv->(3), 6,
ount++;
return wantarray ? (\$x, scalar $cv->()) : \$x;
};
$cv = clone $sub;
isnt scalar $cv->(), scalar $sub->(), 'new lexicals clone';
$count = 0;
my @rv = $sub->
my $c;
return sub { \$c };
}
my $sub = clos;
my $cv = clone $sub;
isnt $cv->(), $sub->(), 'lexical from sub scope is cloned';
}
TODO: {
local $TODO = 'loops not de
my $hv = clone \%hash;
isa_ok b($hv), 'B::HV', 'empty HV cloned';
isnt $hv, \%hash, '...not copied';
is scalar(keys %$hv), 0,
'HV keys cloned';
is $hv->{a}, 'b', 'HV values cloned';
isnt \$hv->{a}, \$hash{a}, '...not copied';
}
SKIP: {
my $skip;
eval 'requir
hv = clone $href;
isa_ok b($hv->{a}), 'B::HV', 'nested HV cloned';
isnt $hv->{a}, $href->{a}, '...not copied';
is $hv->{a}{b}, 'c',
my $av = clone \@ary;
isa_ok b($av), 'B::AV', 'empty AV cloned';
isnt $av, \@ary, '...not copied';
is @$av, 0,
'AV size cloned';
is $av->[1], 'two', 'AV contents cloned';
isnt \$av->[1], \$ary[1], '...not copied';
}
{
BEGIN { $tests += 5 }
my $a
av = clone $aref;
isa_ok b($av->[1]), 'B::AV', 'nested AV cloned';
isnt $av->[1], $aref->[1], '...not copied';
is $av->[1][0], 2,
$RVc, 'RV cloned';
ok b(\$rv)->ROK, '...and is ROK';
isnt $rv, \$scalar, '...not copied';
is $$rv, 5, '
'circular ref cloned';
ok b(\$rv)->ROK, '...and is ROK';
isnt $rv, \$circ, '...not copied';
is $$rv, $rv, '
'...and ROK';
is blessed($rv), 'Foo', '...preserving class';
isnt refaddr($rv), refaddr($blessed),
'...not copied';
$y, 'NVs clone';
isnt $x, $y, '...not copy';
my $c = \"test 2 scalar";
my $d = clone $c;
BEGIN { $tests += 2 }
is $$c, $$d, 'refs clone';
isnt $c, $d,