summaryrefslogtreecommitdiff
path: root/t/taint.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2014-08-24 16:36:19 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2014-08-24 16:36:19 +0000
commitb808141b894ad538db75a7067e0199cbfe6337a9 (patch)
treeb3560724f86d6383c5ded5a79749c3f69592eb51 /t/taint.t
downloadModule-Implementation-tarball-master.tar.gz
Module-Implementation-0.09HEADModule-Implementation-0.09master
Diffstat (limited to 't/taint.t')
-rw-r--r--t/taint.t48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/taint.t b/t/taint.t
new file mode 100644
index 0000000..13f197a
--- /dev/null
+++ b/t/taint.t
@@ -0,0 +1,48 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::Requires {
+ 'Test::Taint' => '0',
+};
+
+use Test::More 0.88;
+use Test::Fatal 0.006;
+
+taint_checking_ok();
+
+{
+ package T;
+
+ use strict;
+ use warnings;
+
+ use lib 't/lib';
+
+ use Module::Implementation;
+ my $loader = Module::Implementation::build_loader_sub(
+ implementations => [ 'Impl1', 'Impl2' ],
+ symbols => ['return_42'],
+ );
+
+ ::taint( $ENV{T_IMPLEMENTATION} = 'Impl2' );
+
+ ::tainted_ok( $ENV{T_IMPLEMENTATION}, '$ENV{T_IMPLEMENTATION} is tainted' );
+
+ ::is(
+ ::exception{ $loader->() },
+ undef,
+ 'no exception when implementation is specified in env var under taint mode'
+ );
+}
+
+{
+ is(
+ Module::Implementation::implementation_for('T'),
+ 'Impl2',
+ 'T::_implementation returns implementation set in ENV'
+ );
+}
+
+done_testing();