Skip to content
Snippets Groups Projects
Commit 8022ed6a authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- added quality tests

parent a7cf9fd3
No related branches found
No related tags found
No related merge requests found
use strict;
use warnings;
use Test::More;
use Perl::Version;
my $required_module_version = '2.3.1';
plan skip_all => "Test::Compile required for testing file compileabilty"
unless eval "use Test::Compile; 1";
plan skip_all => "Test::Compile version $required_module_version required because fixed prove compatibility"
unless (Perl::Version->new($Test::Compile::VERSION) >= Perl::Version->new($required_module_version));
my $test = Test::Compile->new();
$test->verbose => undef;
my @modules = $test->all_pm_files("lib");
my @binaries = $test->all_pl_files("bin");
my $tests = scalar(@modules) + scalar(@binaries);
plan tests => $tests;
foreach my $file (@modules) {
ok($test->pm_file_compiles($file), "checking file $file");
}
foreach my $file (@binaries) {
ok($test->pl_file_compiles($file), "checking file $file");
}
1;
\ No newline at end of file
use strict;
use warnings;
use Test::More;
plan skip_all => "Test::Fixme required for testing unresolved FIXME or TODO issues"
unless eval "use Test::Fixme; 1";
run_tests(
where => 'lib',
match => qr/# *(TODO|FIXME|BUG)\b/i,
filename_match => qr/\.(pm|pl)$/
);
1;
\ No newline at end of file
use strict;
use warnings;
use Test::More;
use File::Find;
use Path::Tiny;
#search all modules as file paths
my @modules;
sub wanted {
$File::Find::name=~ m#SLUB/LZA/.+\.pm$# && -f $_ && push @modules, $File::Find::name;
}
find(\&wanted, "lib/");
foreach my $module (@modules) {
my $content = path( $module )->slurp;
if ($content =~ m/^use diagnostics;/m) {
fail("module $module has 'use diagnostics;', but should only be used for debugging. It could be enabled via 'perl -Mdiagnostics=-traceonly my_script.pl'");
} else {
pass("module $module is fine.");
}
}
done_testing();
1;
use strict;
use warnings;
use Test::More;
use Path::Tiny;
# test
plan skip_all => "Test::NoTabs required for testing filenames portability"
unless eval "use Test::NoTabs; 1";
all_perl_files_ok(
grep { (path($_)->is_dir) && (!/\/.git$/) }
path("./")->children()
); # exclude .git directory
use strict;
use warnings;
use Test::More;
use Path::Tiny;
plan skip_all => "Test::Portability::Files required for testing filenames portability"
unless eval "use Test::Portability::Files; 1";
#options(all_tests => 1); # to be hyper-strict
options(
test_mac_length => 1,
test_space => 1,
test_symlink => 1,
test_special_chars => 1,
test_windows_reserved => 1,
test_case => 1,
);
my $manifestfile;
BEGIN{
# prepare, because we want to check only *.t an *.pm and *.pl files
use File::Find;
my $module_base_dir = path(__FILE__)->parent->parent;
my $lib_dir = $module_base_dir->child("lib");
my $t_dir = $module_base_dir->child("t");
$manifestfile = $module_base_dir->child("MANIFEST")->absolute();
if ($manifestfile->is_file) {
$manifestfile->remove();
}
sub wanted {
m/.*\.(p[ml]|t)$/ &&
-f _ &&
$manifestfile->append($File::Find::name) &&
$manifestfile->append("\n");
}
find(\&wanted, $lib_dir->stringify, $t_dir->stringify);
}
# tests
run_tests();
#clean up
if ($manifestfile->is_file) {
$manifestfile->remove();
}
1;
\ No newline at end of file
use strict;
use warnings;
use Test::More;
BEGIN{
plan skip_all => "Test::Version required for testing module versions"
unless eval "use Test::Version; 1";
use Test::Version qw(version_all_ok), { has_version => 0, filename_match => [qr{SLUB/LZA/.*\.pm$}]};
}
version_all_ok();
done_testing();
1;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment