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