Create a gist now

Instantly share code, notes, and snippets.

anonymous /MyFailure1.pm Secret
Created May 4, 2012

Testcase showing redefinition warning not being caught
#!/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;
package MyFailure1;
use strict;
use warnings;
use base 'Exporter';
our @EXPORT = qw(duplicateFunction);
sub duplicateFunction
{
return;
}
1;
__END__
package MyFailure2;
use strict;
use warnings;
use base 'Exporter';
our @EXPORT = qw(duplicateFunction);
sub duplicateFunction
{
return;
}
1;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment