This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
New test for Safe
[perl5.git] / ext / Safe / t / safeuniversal.t
1 #!perl
2
3 BEGIN {
4     if($ENV{PERL_CORE}) {
5         chdir 't' if -d 't';
6         @INC = '../lib';
7     }
8     require Config;
9     import Config;
10     if ($Config{'extensions'} !~ /\bOpcode\b/) {
11         print "1..0\n";
12         exit 0;
13     }
14 }
15
16 use strict;
17 use Test::More;
18 use Safe;
19 plan(tests => 2);
20
21 my $c = new Safe;
22
23 my $r = $c->reval(q!
24     sub UNIVERSAL::isa { "pwned" }
25     (bless[],"Foo")->isa("Foo");
26 !);
27
28 is( $r, "pwned", "isa overriden in compartment" );
29 is( (bless[],"Foo")->isa("Foo"), 1, "... but not outside" );