line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Poet::t::Import; |
2
|
|
|
|
|
|
|
$Poet::t::Import::VERSION = '0.16'; |
3
|
1
|
|
|
1
|
|
899
|
use Test::Class::Most parent => 'Poet::Test::Class'; |
|
1
|
|
|
|
|
30811
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my ( $temp_env, $importer ); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
|
|
|
|
|
|
$temp_env = __PACKAGE__->initialize_temp_env(); |
9
|
|
|
|
|
|
|
$importer = $temp_env->importer; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub test_valid_vars : Tests { |
13
|
|
|
|
|
|
|
cmp_deeply( $importer->valid_vars, supersetof(qw(cache conf log poet)) ); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub test_import_vars : Tests { |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
package TestImportVars; |
19
|
|
|
|
|
|
|
$TestImportVars::VERSION = '0.16'; |
20
|
|
|
|
|
|
|
BEGIN { $importer->export_to_level( 0, qw($cache $conf $env $poet) ) } |
21
|
|
|
|
|
|
|
use Test::Most; |
22
|
|
|
|
|
|
|
isa_ok( $cache, 'CHI::Driver', '$cache' ); |
23
|
|
|
|
|
|
|
isa_ok( $conf, 'Poet::Conf', '$conf' ); |
24
|
|
|
|
|
|
|
isa_ok( $env, 'Poet::Environment', '$env' ); |
25
|
|
|
|
|
|
|
isa_ok( $poet, 'Poet::Environment', '$poet' ); |
26
|
|
|
|
|
|
|
is( $env, $poet, '$env/$poet backward compat' ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub test_import_bad_vars : Tests { |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
package TestImportVars2; |
33
|
|
|
|
|
|
|
$TestImportVars2::VERSION = '0.16'; |
34
|
|
|
|
|
|
|
use Test::Most; |
35
|
|
|
|
|
|
|
throws_ok( |
36
|
|
|
|
|
|
|
sub { $importer->export_to_level( 0, qw($bad) ) }, |
37
|
|
|
|
|
|
|
qr/unknown import var '\$bad': valid import vars are '\$cache', '\$conf', '\$log', '\$poet'/, |
38
|
|
|
|
|
|
|
'bad import' |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub test_import_methods : Tests { |
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
package TestImportMethods1; |
46
|
|
|
|
|
|
|
$TestImportMethods1::VERSION = '0.16'; |
47
|
|
|
|
|
|
|
BEGIN { $importer->export_to_level(0) } |
48
|
|
|
|
|
|
|
use Test::Most; |
49
|
|
|
|
|
|
|
ok( TestImportMethods1->can('dp'), 'yes dp' ); |
50
|
|
|
|
|
|
|
ok( !TestImportMethods1->can('basename'), 'no basename' ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
package TestImportMethods2; |
54
|
|
|
|
|
|
|
$TestImportMethods2::VERSION = '0.16'; |
55
|
|
|
|
|
|
|
BEGIN { $importer->export_to_level( 0, qw(:file) ) } |
56
|
|
|
|
|
|
|
use Test::Most; |
57
|
|
|
|
|
|
|
foreach my $function (qw(dp basename mkpath rmtree)) { |
58
|
|
|
|
|
|
|
ok( TestImportMethods2->can($function), "yes $function" ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
{ |
62
|
|
|
|
|
|
|
package TestImportMethods3; |
63
|
|
|
|
|
|
|
$TestImportMethods3::VERSION = '0.16'; |
64
|
|
|
|
|
|
|
BEGIN { $importer->export_to_level( 0, qw(:web) ) } |
65
|
|
|
|
|
|
|
use Test::Most; |
66
|
|
|
|
|
|
|
foreach my $function (qw(dp html_escape uri_escape)) { |
67
|
|
|
|
|
|
|
ok( TestImportMethods3->can($function), "yes $function" ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |