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
|
#!perl -Tw
package BigApp::Report;
use strict;
use Test::More;
use lib "t";
plan tests => 7;
use_ok( "relative" );
# load modules with empty import lists
my @loaded = import relative Create => [], "::Tools", Publish => [], "::Utils";
is_deeply(
\@loaded,
[qw(BigApp::Report::Create BigApp::Tools BigApp::Report::Publish BigApp::Utils)],
"check that the modules were correctly loaded"
);
ok( !exists $BigApp::Report::{new_report},
"check that the function 'new_report' was not imported" );
ok( !exists $BigApp::Report::{render},
"check that the function 'render' was not imported" );
# load modules with non-empty import lists
@loaded = import relative Create => ["new_report"], "::Tools", Publish => ["render"], "::Utils";
is_deeply(
\@loaded,
[qw(BigApp::Report::Create BigApp::Tools BigApp::Report::Publish BigApp::Utils)],
"check that the modules were correctly loaded"
);
can_ok( __PACKAGE__, "new_report" );
can_ok( __PACKAGE__, "render" );
|