summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-02-05 14:00:00 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-02-05 14:00:00 +0000
commitc9428f0a83bc030d3c8d0c0756c785c49c127cd5 (patch)
treead3caf38b95cae31c0962fa4f9aa7ccadb417a33 /ext
parenta4409f504bb43538f5255ba90ba9e25fdf6aa83d (diff)
downloadperl-c9428f0a83bc030d3c8d0c0756c785c49c127cd5.tar.gz
Add a new test for Safe
p4raw-id: //depot/perl@33237
Diffstat (limited to 'ext')
-rw-r--r--ext/Safe/t/safeload.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/Safe/t/safeload.t b/ext/Safe/t/safeload.t
new file mode 100644
index 0000000000..6817c2c90f
--- /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 $@;