critic.t 883 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!perl -T
  2. # vi: set tabstop=4 expandtab shiftwidth=4:
  3. use strict;
  4. use warnings;
  5. use Test::More;
  6. use ExtUtils::Manifest qw/maniread/;
  7. my @perl_files;
  8. BEGIN {
  9. my $manifest = maniread();
  10. die 'Unable to read MANIFEST' unless $manifest;
  11. foreach my $file (keys %$manifest) {
  12. if ($file =~ m/.*\.p[ml]$/x) {
  13. push @perl_files, ($file);
  14. }
  15. }
  16. }
  17. unless ($ENV{RELEASE_TESTING}) {
  18. plan(skip_all => 'Author tests not required for installation');
  19. }
  20. else {
  21. eval { require Test::Perl::Critic; };
  22. if ($@) {
  23. plan(skip_all => 'Test::Perl::Critic required');
  24. }
  25. else {
  26. Test::Perl::Critic->import(
  27. -severity => 4,
  28. -exclude => 'Variables::RequireLocalizedPunctuationVars'
  29. );
  30. plan(tests => scalar @perl_files);
  31. }
  32. }
  33. foreach my $file (sort @perl_files) {
  34. critic_ok($file);
  35. }