|
Packit |
549706 |
#!/usr/bin/perl
|
|
Packit |
549706 |
|
|
Packit |
549706 |
# Load testing for prefork.pm
|
|
Packit |
549706 |
|
|
Packit |
549706 |
use strict;
|
|
Packit |
549706 |
BEGIN {
|
|
Packit |
549706 |
$| = 1;
|
|
Packit |
549706 |
$^W = 1;
|
|
Packit |
549706 |
}
|
|
Packit |
549706 |
use Test::More tests => 12;
|
|
Packit |
549706 |
|
|
Packit |
549706 |
# Try to prefork-load a module
|
|
Packit |
549706 |
use_ok( 'prefork', 'File::Spec::Functions' );
|
|
Packit |
549706 |
is( $prefork::MODULES{'File::Spec::Functions'}, 'File/Spec/Functions.pm', 'Module is added to queue' );
|
|
Packit |
549706 |
ok( ! $INC{'File/Spec/Functions.pm'}, 'Module is not loaded' );
|
|
Packit |
549706 |
|
|
Packit |
549706 |
# Load outstanding modules
|
|
Packit |
549706 |
is( $prefork::FORKING, '', 'The $FORKING variable is false' );
|
|
Packit |
549706 |
use_ok( 'prefork', ':enable' );
|
|
Packit |
549706 |
is( scalar(keys %prefork::MODULES), 0, 'All modules are loaded by enable' );
|
|
Packit |
549706 |
is( $prefork::FORKING, 1, 'The $FORKING variable is set' );
|
|
Packit |
549706 |
ok( $INC{'File/Spec/Functions.pm'}, 'Module is now loaded' );
|
|
Packit |
549706 |
|
|
Packit |
549706 |
# use in pragma form after enabling
|
|
Packit |
549706 |
ok( ! $INC{'Test/Simple.pm'}, 'Test::Simple is not loaded' );
|
|
Packit |
549706 |
use_ok( 'prefork', 'Test::Simple' );
|
|
Packit |
549706 |
is( scalar(keys %prefork::MODULES), 0, 'The %MODULES hash is still empty' );
|
|
Packit |
549706 |
ok( $INC{'Test/Simple.pm'}, 'Test::Simple is loaded' );
|