Commit | Line | Data |
33f7e1aa |
1 | #!perl |
2 | |
3 | BEGIN { |
4 | if ($ENV{PERL_CORE}) { |
5 | chdir 't' if -d 't'; |
6 | @INC = '../lib'; |
7 | require Config; import Config; |
8 | if ($Config{'extensions'} !~ /\bOpcode\b/ |
9 | && $Config{'extensions'} !~ /\bPOSIX\b/ |
10 | && $Config{'osname'} ne 'VMS') |
11 | { |
12 | print "1..0\n"; |
13 | exit 0; |
14 | } |
15 | } |
16 | } |
17 | |
18 | use strict; |
19 | use warnings; |
20 | use POSIX qw(ceil); |
21 | use Test::More tests => 1; |
22 | use Safe; |
23 | |
24 | my $safe = new Safe; |
25 | $safe->deny('add'); |
26 | |
27 | # Attempt to change the opmask from within the safe compartment |
28 | $safe->reval( qq{\$_[1] = q/\0/ x } . ceil( Opcode::opcodes / 8 ) ); |
29 | |
30 | # Check that it didn't work |
31 | $safe->reval( q{$x + $y} ); |
32 | like( $@, qr/^'?addition \(\+\)'? trapped by operation mask/, |
33 | 'opmask still in place' ); |