1N/A# Set up a package namespace of things to be visible to the unsafe code 1N/A# Stop perl from moaning about identifies which are apparently only used once 1N/A# create and destroy a couple of automatic Safe compartments first 1N/A print $foo eq 'visible' ? "ok 2\n" : "not ok 2\n"; 1N/Aprint $@ ?
"not ok 7\n#$@" :
"ok 7\n";
1N/A@glob = qw(not ok 16); 1N/Asub sayok { print "ok @_\n
" } 1N/A$cpt->share('$"') unless $Config{use5005threads}; 1N/A sub other_sayok { print "ok @_\n" } 1N/A print $foo ? $foo : "not ok 8\n"; 1N/A print $bar{key} ? $bar{key} : "not ok 9\n"; 1N/A (@baz) ? print "@baz\n" : print "not ok 10\n"; 1N/A other::other_sayok(12); 1N/A $bar{new} = "ok 15\n"; 1N/Aprint $@ ? "not ok 13\n#$@" : "ok 13\n"; 1N/Aprint $foo, $bar{new}, "@glob\n"; 1N/A$Root::foo = "not ok 17"; 1N/A@{$cpt->varglob('bar')} = qw(not ok 18); 1N/A${$cpt->varglob('foo')} = "ok 17"; 1N/Apush(@Root::bar, "18"); # Two steps to prevent "Identifier used only once..." 1N/Aprint "$Root::foo\n"; 1N/Aprint "@{$cpt->varglob('bar')}\n"; 1N/Aprint 1 ? "ok 19\n" : "not ok 19\n"; 1N/Aprint 1 ? "ok 20\n" : "not ok 20\n"; 1N/A$cpt->trap("negate"); 1N/Amy @masked = opset_to_ops($m1); 1N/Aprint $m2 eq opset("negate", @masked) ? "ok 21\n" : "not ok 21\n"; 1N/Aprint eval { $cpt->mask("a bad mask") } ? "not ok 22\n" : "ok 22\n"; 1N/Aprint $cpt->reval("2 + 2") == 4 ? "ok 23\n" : "not ok 23\n"; 1N/A$cpt->mask(empty_opset); 1N/Amy $t_scalar = $cpt->reval('print wantarray ?
"not ok 24\n" :
"ok 24\n"'); 1N/Aprint $cpt->reval('@
ary=
(6,7,8);@
ary') == 3 ? "ok 25\n" : "not ok 25\n"; 1N/Amy @t_array = $cpt->reval('print wantarray ?
"ok 26\n" :
"not ok 26\n";
(2,3,4)'); 1N/Aprint $t_array[2] == 4 ? "ok 27\n" : "not ok 27\n"; 1N/Amy $t_scalar2 = $cpt->reval('die "foo bar";
1'); 1N/Aprint defined $t_scalar2 ? "not ok 28\n" : "ok 28\n"; 1N/Aprint $@ =~ /foo bar/ ? "ok 29\n" : "not ok 29\n"; 1N/Aopen(NOSUCH, $nosuch); 1N/A die "Eek! Attempting to open $nosuch failed, but \$! is still 0" unless $!; 1N/A print $! == $errno ? "ok $t\n" : sprintf "not ok $t # \"$!\" is %d (expected %d)\n", $!, $errno; $t++; 1N/A# $cpt->permit_only('const', 'leaveeval'); 1N/A# print "# test $t skipped, can't open file: $!\nok $t\n"; $t++;