Skip to content

Commit

Permalink
Perl::Critic clean-up of test suites.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjray committed Feb 17, 2014
1 parent 70f6e31 commit 93f34fa
Show file tree
Hide file tree
Showing 25 changed files with 1,691 additions and 1,089 deletions.
75 changes: 42 additions & 33 deletions t/00_load.t
@@ -1,54 +1,63 @@
#!/usr/bin/perl #!/usr/bin/env perl


use strict; use strict;
use vars qw(@MODULES @APACHE_MODULES $do_apache $do_libxml); use warnings;


use Module::Load;
use Test::More; use Test::More;


# Verify that the individual modules will load # Verify that the individual modules will load


BEGIN my @MODULES = qw(
{ RPC::XML
@MODULES = qw( RPC::XML::Client
RPC::XML RPC::XML::Parser
RPC::XML::Client RPC::XML::Parser::XMLParser
RPC::XML::Parser RPC::XML::ParserFactory
RPC::XML::Parser::XMLLibXML RPC::XML::Procedure
RPC::XML::Parser::XMLParser RPC::XML::Server
RPC::XML::ParserFactory );
RPC::XML::Procedure my @APACHE_MODULES = qw(Apache::RPC::Server Apache::RPC::Status);
RPC::XML::Server my @LIBXML_MODULES = qw(RPC::XML::Parser::XMLLibXML);
);
@APACHE_MODULES = qw(Apache::RPC::Server Apache::RPC::Status); # If mod_perl is not available, Apache::RPC::Server cannot be blamed

my $do_apache = eval { load Apache; 1; };
# If mod_perl is not available, Apache::RPC::Server cannot be blamed
eval "use Apache"; # If XML::LibXML is not installed, also skip RPC::XML::Parser::XMLLibXML
$do_apache = $@ ? 0 : 1; my $do_libxml = eval { load XML::LibXML; 1; };


# If XML::LibXML is not installed, also skip RPC::XML::Parser::XMLLibXML plan tests => (@MODULES + @APACHE_MODULES + @LIBXML_MODULES);
eval "use XML::LibXML";
$do_libxml = $@ ? 0 : 1;

plan tests => (scalar(@MODULES) + scalar(@APACHE_MODULES));
}


# Core modules # Core modules
for my $module (@MODULES) for my $module (@MODULES)
{ {
SKIP: { use_ok $module;
skip 'XML::LibXML not installed', 1 }
if (($module eq 'RPC::XML::Parser::XMLLibXML') &&
(! $do_libxml));


use_ok($module); # Test these only if XML::LibXML is available
SKIP: {
if (! $do_libxml)
{
skip 'No XML::LibXML detected', scalar @LIBXML_MODULES;
}

for my $module (@LIBXML_MODULES)
{
use_ok $module;
} }
} }


# Test these only if Apache (v1) is available # Test these only if Apache (v1) is available
SKIP: { SKIP: {
skip "No mod_perl 1.X detected", scalar(@APACHE_MODULES) unless $do_apache; if (! $do_apache)
{
skip 'No mod_perl 1.X detected', scalar @APACHE_MODULES;
}


use_ok($_) for (@APACHE_MODULES); for my $module (@APACHE_MODULES)
{
use_ok $module;
}
} }


exit 0; exit 0;

0 comments on commit 93f34fa

Please sign in to comment.