diff --git a/t/compile.t b/t/compile.t new file mode 100644 index 0000000000000000000000000000000000000000..44208c0655128d0bdd12a75a5a59098560f1efea --- /dev/null +++ b/t/compile.t @@ -0,0 +1,29 @@ +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 diff --git a/t/fixme.t b/t/fixme.t new file mode 100644 index 0000000000000000000000000000000000000000..c948898fa1e348c88097e6b6abaa227199f3bf03 --- /dev/null +++ b/t/fixme.t @@ -0,0 +1,11 @@ +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 diff --git a/t/nodiagnostics.t b/t/nodiagnostics.t new file mode 100644 index 0000000000000000000000000000000000000000..0e7ba25c8929d41b55e714306ce1cba0d74c163d --- /dev/null +++ b/t/nodiagnostics.t @@ -0,0 +1,24 @@ +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; diff --git a/t/notabs.t b/t/notabs.t new file mode 100644 index 0000000000000000000000000000000000000000..680b00b60aeb8e68dea140e4cf47b3a81322acf9 --- /dev/null +++ b/t/notabs.t @@ -0,0 +1,11 @@ +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 diff --git a/t/portability.t b/t/portability.t new file mode 100644 index 0000000000000000000000000000000000000000..1377d8c497d09615b2786018045636c077a50a5c --- /dev/null +++ b/t/portability.t @@ -0,0 +1,48 @@ +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 diff --git a/t/versions.t b/t/versions.t new file mode 100644 index 0000000000000000000000000000000000000000..b767850d1ed6ad35cdfb839c61d44ddd1bf95f06 --- /dev/null +++ b/t/versions.t @@ -0,0 +1,13 @@ +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