blob: c1d439e90d763beae84add6161bf78d08c36ed49 (
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
|
use strict;
use warnings;
use Test::More 0.88;
{
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'],
);
$ENV{T_IMPLEMENTATION} = 'Impl2';
$loader->();
}
{
ok( T->can('return_42'), 'T package has a return_42 sub' );
ok(
!T->can('return_package'),
'T package does not have return_package sub - only copied requested symbols'
);
is( T::return_42(), 42, 'T::return_42 work as expected' );
is(
Module::Implementation::implementation_for('T'),
'Impl2',
'T::_implementation returns implementation set in ENV'
);
}
done_testing();
|