secret
anonymous / MyFailure1.pm
Created

Testcase showing redefinition warning not being caught

  • Download Gist
MyFailure1.pm
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package MyFailure1;
 
use strict;
use warnings;
use base 'Exporter';
 
our @EXPORT = qw(duplicateFunction);
 
sub duplicateFunction
{
return;
}
 
1;
 
__END__
MyFailure2.pm
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package MyFailure2;
 
use strict;
use warnings;
use base 'Exporter';
 
our @EXPORT = qw(duplicateFunction);
 
sub duplicateFunction
{
return;
}
 
1;
 
__END__
loadModules.t
Perl
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 32 33 34
#!/usr/bin/perl -w
use File::Find;
use File::Spec;
use Test::More;
use Test::NoWarnings;
use warnings FATAL => qw(all);
 
my @files;
File::Find::find(
sub
{
if (/\.pm$/ && $File::Find::dir)
{
push(@files, $File::Find::name);
}
},
"."
);
done_testing(scalar(@files) + 1); # Test::NoWarnings adds an implicit test case
 
foreach my $file (@files)
{
my $path = File::Spec->canonpath($file);
my $includeString = "$file";
if ($path =~ /(.*)\.pm/)
{
my $relativePath = $1;
my @subPath = split /\\/, $relativePath;
$includeString = join '::', @subPath;
}
use_ok($includeString);
}
 
1;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.