blob: 13f197ad4e61a79b9e39c6c97302b0743c8dbaee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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();
|