From: Rafael Garcia-Suarez Date: Fri, 12 Oct 2007 09:43:20 +0000 (+0000) Subject: New test for Safe X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=144c260c66e91246a2209df42a430484ee2d6ad4;p=p5sagit%2Fp5-mst-13.2.git New test for Safe p4raw-id: //depot/perl@32104 --- diff --git a/MANIFEST b/MANIFEST index 2339727..69fe314 100644 --- a/MANIFEST +++ b/MANIFEST @@ -991,6 +991,7 @@ ext/Safe/t/safe1.t See if Safe works ext/Safe/t/safe2.t See if Safe works ext/Safe/t/safe3.t See if Safe works ext/Safe/t/safeops.t Tests that all ops can be trapped by Safe +ext/Safe/t/safeuniversal.t Tests Safe with functions from universal.c ext/SDBM_File/Makefile.PL SDBM extension makefile writer ext/SDBM_File/sdbm/biblio SDBM kit ext/SDBM_File/sdbm/CHANGES SDBM kit diff --git a/ext/Safe/t/safeuniversal.t b/ext/Safe/t/safeuniversal.t new file mode 100644 index 0000000..6690f5f --- /dev/null +++ b/ext/Safe/t/safeuniversal.t @@ -0,0 +1,29 @@ +#!perl + +BEGIN { + if($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = '../lib'; + } + require Config; + import Config; + if ($Config{'extensions'} !~ /\bOpcode\b/) { + print "1..0\n"; + exit 0; + } +} + +use strict; +use Test::More; +use Safe; +plan(tests => 2); + +my $c = new Safe; + +my $r = $c->reval(q! + sub UNIVERSAL::isa { "pwned" } + (bless[],"Foo")->isa("Foo"); +!); + +is( $r, "pwned", "isa overriden in compartment" ); +is( (bless[],"Foo")->isa("Foo"), 1, "... but not outside" );