Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add some author tests (Pod, Perl::Critic, etc)
  • Loading branch information
hinrik committed Jul 1, 2009
1 parent 7d7f20f commit 5a0d6ae
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,4 +1,5 @@
0.09
- Add some author tests (Pod, Perl::Critic, etc)
- Detect whether a file contains Pod 5 or Pod 6
- Add homepage and source repository to Makefile.PL
- Refactor the code a bit and document public methods
Expand Down
7 changes: 7 additions & 0 deletions MANIFEST
Expand Up @@ -23,6 +23,12 @@ t/04_targets/01_file.t
t/04_targets/02_synopsis.t
t_source/basic.pod
t_source/basic5.pod
xt/perlcriticrc
xt/perlcriticrc_tests
xt/perl_critic.t
xt/perl_critic_tests.t
xt/pod_coverage.t
xt/pod.t
share/Spec/S01-overview.pod
share/Spec/S02-bits.pod
share/Spec/S03-operators.pod
Expand Down Expand Up @@ -56,6 +62,7 @@ share/Spec/S32-setting-library/Rules.pod
share/Spec/S32-setting-library/Str.pod
share/Spec/S32-setting-library/Temporal.pod
inc/Module/Install.pm
inc/Module/Install/AuthorTests.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
Expand Down
1 change: 1 addition & 0 deletions Makefile.PL
Expand Up @@ -26,5 +26,6 @@ requires ('Win32::Console::ANSI' => '0') if $^O eq 'MSWin32';
test_requires ('Test::More' => '0');
test_requires ('Test::Script' => '0');
tests_recursive();
recursive_author_tests('xt');
WriteAll();

20 changes: 20 additions & 0 deletions xt/perl_critic.t
@@ -0,0 +1,20 @@
use strict;
use warnings;
use File::Spec;
use Test::More;
use English qw(-no_match_vars);

eval { require Test::Perl::Critic; };

if ( $EVAL_ERROR ) {
my $msg = 'Test::Perl::Critic required to criticise code';
plan( skip_all => $msg );
}
elsif ($Perl::Critic::VERSION lt 1.098) {
my $msg = 'Perl::Critic >= 1.098 required to criticise code';
plan( skip_all => $msg );
}

my $rcfile = File::Spec->catfile( 'xt', 'perlcriticrc' );
Test::Perl::Critic->import( -profile => $rcfile );
all_critic_ok();
20 changes: 20 additions & 0 deletions xt/perl_critic_tests.t
@@ -0,0 +1,20 @@
use strict;
use warnings;
use File::Spec;
use Test::More;
use English qw(-no_match_vars);

eval { require Test::Perl::Critic; };

if ( $EVAL_ERROR ) {
my $msg = 'Test::Perl::Critic required to criticise code';
plan( skip_all => $msg );
}
elsif ($Perl::Critic::VERSION lt 1.098) {
my $msg = 'Perl::Critic >= 1.098 required to criticise code';
plan( skip_all => $msg );
}

my $rcfile = File::Spec->catfile( 'xt', 'perlcriticrc_tests' );
Test::Perl::Critic->import( -profile => $rcfile );
all_critic_ok(glob 't/0*');
20 changes: 20 additions & 0 deletions xt/perlcriticrc
@@ -0,0 +1,20 @@
# level 3 is a nice compromise
severity = 3
verbose = 3

# these policies are either too anal, demand additional dependencies,
# or inhibit backwards-compatability
[-RegularExpressions::RequireExtendedFormatting]

[-ValuesAndExpressions::ProhibitConstantPragma]

[-Variables::ProhibitPackageVars]
[-Variables::RequireLocalizedPunctuationVars]

[-BuiltinFunctions::ProhibitStringyEval]

[-Subroutines::ProhibitBuiltinHomonyms]
[-Subroutines::RequireArgUnpacking]

[-ErrorHandling::RequireCarping]
[-ErrorHandling::RequireCheckingReturnValueOfEval]
28 changes: 28 additions & 0 deletions xt/perlcriticrc_tests
@@ -0,0 +1,28 @@
# level 3 is a nice compromise
severity = 3
verbose = 3

# these policies are either too anal, demand additional dependencies,
# or inhibit backwards-compatability
[-RegularExpressions::RequireExtendedFormatting]

[-ValuesAndExpressions::ProhibitConstantPragma]

[-Variables::ProhibitPackageVars]
[-Variables::RequireLocalizedPunctuationVars]

[-BuiltinFunctions::ProhibitStringyEval]

[-Subroutines::ProhibitBuiltinHomonyms]
[-Subroutines::RequireArgUnpacking]

[-ErrorHandling::RequireCarping]
[-ErrorHandling::RequireCheckingReturnValueOfEval]

# more policies we don't care about in tests
[-InputOutput::RequireBriefOpen]
[-Modules::RequireEndWithOne]
[-Modules::RequireExplicitPackage]
[-Modules::RequireFilenameMatchesPackage]
[-Subroutines::RequireFinalReturn]
[-InputOutput::ProhibitBacktickOperators]
7 changes: 7 additions & 0 deletions xt/pod.t
@@ -0,0 +1,7 @@
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;

# we need to specify lib/ and script/ manually so it won't find the
# bundled documentation in blib/
all_pod_files_ok(all_pod_files(qw(lib script)));
11 changes: 11 additions & 0 deletions xt/pod_coverage.t
@@ -0,0 +1,11 @@
use Test::More;
eval "use Test::Pod::Coverage 1.00";
plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;

my $opts = { also_private => [ qr/^[SU]_/, qr/^PCI_/, qr/^(sl_|plugin_)/, qr/^(commasep|noargs|oneandtwoopt|onlyonearg|onlytwoargs|privandnotice|sl|spacesep|oneortwo|oneoptarg)$/,], };

my @modules = all_modules();

plan tests => scalar @modules;

pod_coverage_ok( $_, $opts ) for @modules;

0 comments on commit 5a0d6ae

Please sign in to comment.