From: Rafael Garcia-Suarez Date: Tue, 5 Feb 2008 14:00:00 +0000 (+0000) Subject: Add a new test for Safe X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=616f6b200d3b7cfb1c66823bd1f33769d9468304;p=p5sagit%2Fp5-mst-13.2.git Add a new test for Safe p4raw-id: //depot/perl@33237 --- diff --git a/MANIFEST b/MANIFEST index 2c3dd58..a49b81b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1006,6 +1006,7 @@ ext/re/t/re.t see if re pragma works 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/safeload.t Tests that some modules can be loaded by Safe 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 diff --git a/ext/Safe/t/safeload.t b/ext/Safe/t/safeload.t new file mode 100644 index 0000000..6817c2c --- /dev/null +++ b/ext/Safe/t/safeload.t @@ -0,0 +1,30 @@ +#!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; + } + # Can we load the version module ? + eval { require version; 1 } or do { + print "1..0 # no version.pm\n"; + exit 0; + }; + delete $INC{"version.pm"}; +} + +use strict; +use Test::More; +use Safe; +plan(tests => 1); + +my $c = new Safe; +$c->permit(qw(require caller)); +my $r = $c->reval(q{ use version; 1 }); +ok( defined $r, "Can load version.pm in a Safe compartment" ) or diag $@;