view release on metacpan or search on metacpan
portable/stdbool.h
portable/system.h
README
t/data/perl.conf
t/data/perlcriticrc
t/data/perltidyrc
t/docs/pod-coverage.t
t/docs/pod-spelling.t
t/docs/pod.t
t/docs/synopsis.t
t/lib/Test/RRA.pm
t/lib/Test/RRA/Config.pm
t/pag/basic.t
t/pag/isolation.t
t/style/coverage.t
t/style/critic.t
t/style/minimum-version.t
t/style/strict.t
TODO
META.yml
META.json
Perl 5.10.1 or later, the Config::AutoConf module, and a C compiler are
required to build this module. On any platform other than Linux, either
the kafs library (from Heimdal) or the kopenafs library (from recent
versions of OpenAFS) are also required.
The following additional Perl modules will be used by the test suite if
present:
IPC::System::Simple
Test::MinimumVersion
Test::Perl::Critic
Test::Pod
Test::Pod::Coverage
Test::Spelling
Test::Strict
Test::Synopsis
All are available on CPAN. Those tests will be skipped if the modules
are not available.
To enable tests that may be sensitive to the local environment or that
produce a lot of false positives without uncovering many problems, set
RRA_MAINTAINER_TESTS to a true value.
BUILDING AND INSTALLATION
t/data/perlcriticrc view on Meta::CPAN
# group coding style.
[-CodeLayout::ProhibitParensWithBuiltins]
# Stanford's coding style allows postfix unless for flow control. There
# doesn't appear to be any way to allow it only for flow control (the logic
# for "if" and "when" appears to be special-cased), so we have to allow unless
# globally.
[ControlStructures::ProhibitPostfixControls]
allow = unless
# This is handled with a separate test case that uses Test::Spelling.
[-Documentation::PodSpelling]
# Pod::Man and Pod::Text fixed this bug years ago. I know, I maintain them.
[-Documentation::RequirePodLinksIncludeText]
# The POD sections Perl::Critic wants are incompatible with the POD template
# from perlpodstyle, which is what I use for my POD documentation.
[-Documentation::RequirePodSections]
# This problem was fixed in Perl 5.14, which now properly preserves the value
t/docs/pod-coverage.t view on Meta::CPAN
#!/usr/bin/perl
#
# Test that all methods are documented in POD.
#
# The canonical version of this file is maintained in the rra-c-util package,
# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
t/docs/pod-coverage.t view on Meta::CPAN
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use Test::RRA qw(skip_unless_automated use_prereq);
use Test::RRA::Config qw(@POD_COVERAGE_EXCLUDE);
# Skip for normal user installs since this doesn't affect functionality.
skip_unless_automated('POD coverage tests');
# Load prerequisite modules.
use_prereq('Test::Pod::Coverage');
# Test everything found in the distribution.
all_pod_coverage_ok({ also_private => [@POD_COVERAGE_EXCLUDE] });
t/docs/pod-spelling.t view on Meta::CPAN
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use Test::RRA qw(skip_unless_author use_prereq);
# Only run this test for the module author since the required stopwords are
# too sensitive to the exact spell-checking program and dictionary.
skip_unless_author('Spelling tests');
# Load prerequisite modules.
use_prereq('Test::Spelling');
# Check all POD in the Perl distribution. Add the examples directory if it
# exists. Also add any files in usr/bin or usr/sbin, which are widely used in
# Stanford-internal packages.
my @files = all_pod_files();
if (-d 'examples') {
push(@files, all_pod_files('examples'));
}
for my $dir (qw(usr/bin usr/sbin)) {
if (-d $dir) {
t/docs/pod.t view on Meta::CPAN
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use Test::RRA qw(skip_unless_automated use_prereq);
# Skip this test for normal user installs, although pod2man may still fail.
skip_unless_automated('POD syntax tests');
# Load prerequisite modules.
use_prereq('Test::Pod');
# Check all POD in the Perl distribution. Add the examples directory if it
# exists. Also add any files in usr/bin or usr/sbin, which are widely used in
# Stanford-internal packages.
my @files = all_pod_files();
if (-d 'examples') {
push(@files, all_pod_files('examples'));
}
for my $dir (qw(usr/bin usr/sbin)) {
if (-d $dir) {
t/docs/synopsis.t view on Meta::CPAN
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use Test::RRA qw(skip_unless_automated use_prereq);
# Skip for normal user installs since this doesn't affect functionality.
skip_unless_automated('Synopsis syntax tests');
# Load prerequisite modules.
use_prereq('Perl::Critic::Utils');
use_prereq('Test::Synopsis');
# The default Test::Synopsis all_synopsis_ok() function requires that the
# module be in a lib directory. Use Perl::Critic::Utils to find the modules
# in blib, or lib if it doesn't exist. However, strip out anything in
# blib/script, since scripts use a different SYNOPSIS syntax.
my @files = Perl::Critic::Utils::all_perl_files('blib');
@files = grep { !m{blib/script/}xms } @files;
if (!@files) {
@files = Perl::Critic::Utils::all_perl_files('lib');
}
plan tests => scalar @files;
t/lib/Test/RRA.pm view on Meta::CPAN
# Helper functions for test programs written in Perl.
#
# This module provides a collection of helper functions used by test programs
# written in Perl. This is a general collection of functions that can be used
# by both C packages with Automake and by stand-alone Perl modules. See
# Test::RRA::Automake for additional functions specifically for C Automake
# distributions.
#
# The canonical version of this file is maintained in the rra-c-util package,
# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
t/lib/Test/RRA.pm view on Meta::CPAN
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
package Test::RRA;
use 5.006;
use strict;
use warnings;
use Exporter;
use Test::More;
# For Perl 5.006 compatibility.
## no critic (ClassHierarchies::ProhibitExplicitISA)
# Declare variables that should be set in BEGIN for robustness.
our (@EXPORT_OK, @ISA, $VERSION);
# Set $VERSION and everything export-related in a BEGIN block for robustness
# against circular module loading (not that we load any modules, but
# consistency is good).
t/lib/Test/RRA.pm view on Meta::CPAN
}
plan skip_all => "$description normally skipped";
return;
}
# Attempt to load a module and skip the test if the module could not be
# loaded. If the module could be loaded, call its import function manually.
# If the module could not be loaded, calls plan skip_all, which will terminate
# the program.
#
# The special logic here is based on Test::More and is required to get the
# imports to happen in the caller's namespace.
#
# $module - Name of the module to load
# @imports - Any arguments to import, possibly including a version
#
# Returns: undef
sub use_prereq {
my ($module, @imports) = @_;
# If the first import looks like a version, pass it as a bare string.
my $version = q{};
if (@imports >= 1 && $imports[0] =~ m{ \A \d+ (?: [.][\d_]+ )* \z }xms) {
$version = shift(@imports);
}
# Get caller information to put imports in the correct package.
my ($package) = caller;
# Do the import with eval, and try to isolate it from the surrounding
# context as much as possible. Based heavily on Test::More::_eval.
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (ValuesAndExpressions::ProhibitImplicitNewlines)
my ($result, $error, $sigdie);
{
local $@ = undef;
local $! = undef;
local $SIG{__DIE__} = undef;
$result = eval qq{
package $package;
use $module $version \@imports;
t/lib/Test/RRA.pm view on Meta::CPAN
1;
__END__
=for stopwords
Allbery Allbery's DESC bareword sublicense MERCHANTABILITY NONINFRINGEMENT
rra-c-util
=head1 NAME
Test::RRA - Support functions for Perl tests
=head1 SYNOPSIS
use Test::RRA
qw(skip_unless_author skip_unless_automated use_prereq);
# Skip this test unless author tests are requested.
skip_unless_author('Coding style tests');
# Skip this test unless doing automated or release testing.
skip_unless_automated('POD syntax tests');
# Load modules, skipping the test if they're not available.
use_prereq('Perl6::Slurp', 'slurp');
use_prereq('Test::Script::Run', '0.04');
=head1 DESCRIPTION
This module collects utility functions that are useful for Perl test
scripts. It assumes Russ Allbery's Perl module layout and test
conventions and will only be useful for other people if they use the
same conventions.
=head1 FUNCTIONS
None of these functions are imported by default. The ones used by a
script should be explicitly imported.
=over 4
=item skip_unless_author(DESC)
Checks whether AUTHOR_TESTING is set in the environment and skips the
whole test (by calling C<plan skip_all> from Test::More) if it is not.
DESC is a description of the tests being skipped. A space and C<only run
for author> will be appended to it and used as the skip reason.
=item skip_unless_automated(DESC)
Checks whether AUTHOR_TESTING, AUTOMATED_TESTING, or RELEASE_TESTING are
set in the environment and skips the whole test (by calling C<plan
skip_all> from Test::More) if they are not. This should be used by tests
that should not run during end-user installs of the module, but which
should run as part of CPAN smoke testing and release testing.
DESC is a description of the tests being skipped. A space and C<normally
skipped> will be appended to it and used as the skip reason.
=item use_prereq(MODULE[, VERSION][, IMPORT ...])
Attempts to load MODULE with the given VERSION and import arguments. If
this fails for any reason, the test will be skipped (by calling C<plan
skip_all> from Test::More) with a skip reason saying that MODULE is
required for the test.
VERSION will be passed to C<use> as a version bareword if it looks like a
version number. The remaining IMPORT arguments will be passed as the
value of an array.
=back
=head1 AUTHOR
t/lib/Test/RRA.pm view on Meta::CPAN
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
=head1 SEE ALSO
Test::More(3), Test::RRA::Automake(3), Test::RRA::Config(3)
This module is maintained in the rra-c-util package. The current version
is available from L<http://www.eyrie.org/~eagle/software/rra-c-util/>.
The functions to control when tests are run use environment variables
defined by the L<Lancaster
Consensus|https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md>.
=cut
t/lib/Test/RRA/Config.pm view on Meta::CPAN
# Configuration for Perl test cases.
#
# In order to reuse the same Perl test cases in multiple packages, I use a
# configuration file to store some package-specific data. This module loads
# that configuration and provides the namespace for the configuration
# settings.
#
# The canonical version of this file is maintained in the rra-c-util package,
# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
package Test::RRA::Config;
use 5.006;
use strict;
use warnings;
# For Perl 5.006 compatibility.
## no critic (ClassHierarchies::ProhibitExplicitISA)
use Exporter;
use Test::More;
# Declare variables that should be set in BEGIN for robustness.
our (@EXPORT_OK, @ISA, $VERSION);
# Set $VERSION and everything export-related in a BEGIN block for robustness
# against circular module loading (not that we load any modules, but
# consistency is good).
BEGIN {
@ISA = qw(Exporter);
@EXPORT_OK = qw(
t/lib/Test/RRA/Config.pm view on Meta::CPAN
);
# This version should match the corresponding rra-c-util release, but with
# two digits for the minor version, including a leading zero if necessary,
# so that it will sort properly.
$VERSION = '5.05';
}
# If BUILD or SOURCE are set in the environment, look for data/perl.conf under
# those paths for a C Automake package. Otherwise, look in t/data/perl.conf
# for a standalone Perl module. Don't use Test::RRA::Automake since it may
# not exist.
our $PATH;
for my $base ($ENV{BUILD}, $ENV{SOURCE}, 't') {
next if !defined($base);
my $path = "$base/data/perl.conf";
if (-r $path) {
$PATH = $path;
last;
}
}
t/lib/Test/RRA/Config.pm view on Meta::CPAN
1;
__END__
=for stopwords
Allbery rra-c-util Automake perlcritic .libs namespace subdirectory
sublicense MERCHANTABILITY NONINFRINGEMENT
=head1 NAME
Test::RRA::Config - Perl test configuration
=head1 SYNOPSIS
use Test::RRA::Config qw($MINIMUM_VERSION);
print "Required Perl version is $MINIMUM_VERSION\n";
=head1 DESCRIPTION
Test::RRA::Config encapsulates per-package configuration for generic Perl
test programs that are shared between multiple packages using the
rra-c-util infrastructure. It handles locating and loading the test
configuration file for both C Automake packages and stand-alone Perl
modules.
Test::RRA::Config looks for a file named F<data/perl.conf> relative to the
root of the test directory. That root is taken from the environment
variables BUILD or SOURCE (in that order) if set, which will be the case
for C Automake packages using C TAP Harness. If neither is set, it
expects the root of the test directory to be a directory named F<t>
relative to the current directory, which will be the case for stand-alone
Perl modules.
The following variables are supported:
=over 4
=item $COVERAGE_LEVEL
The coverage level achieved by the test suite for Perl test coverage
testing using Test::Strict, as a percentage. The test will fail if test
coverage less than this percentage is achieved. If not given, defaults
to 100.
=item @COVERAGE_SKIP_TESTS
Directories under F<t> whose tests should be skipped when doing coverage
testing. This can be tests that won't contribute to coverage or tests
that don't run properly under Devel::Cover for some reason (such as ones
that use taint checking). F<docs> and F<style> will always be skipped
regardless of this setting.
t/lib/Test/RRA/Config.pm view on Meta::CPAN
=item @POD_COVERAGE_EXCLUDE
Regexes that match method names that should be excluded from POD coverage
testing. Normally, all methods have to be documented in the POD for a
Perl module, but methods matching any of these regexes will be considered
private and won't require documentation.
=item @STRICT_IGNORE
Additional directories to ignore when doing recursive Test::Strict testing
for C<use strict> and C<use warnings>. The contents of this directory
must be either top-level directory names or directory names starting with
F<tests/>.
=item @STRICT_PREREQ
A list of Perl modules that have to be available in order to do meaningful
Test::Strict testing. If any of the modules cannot be loaded via C<use>,
Test::Strict checking will be skipped. There is currently no way to
require specific versions of the modules.
=back
No variables are exported by default, but the variables can be imported
into the local namespace to avoid long variable names.
=head1 AUTHOR
Russ Allbery <eagle@eyrie.org>
t/lib/Test/RRA/Config.pm view on Meta::CPAN
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
=head1 SEE ALSO
perlcritic(1), Test::MinimumVersion(3), Test::RRA(3),
Test::RRA::Automake(3), Test::Strict(3)
This module is maintained in the rra-c-util package. The current version
is available from L<http://www.eyrie.org/~eagle/software/rra-c-util/>.
The C TAP Harness test driver and libraries for TAP-based C testing are
available from L<http://www.eyrie.org/~eagle/software/c-tap-harness/>.
=cut
t/pag/basic.t view on Meta::CPAN
#!/usr/bin/perl
#
# Tests for basic AFS::PAG functionality.
#
# Written by Russ Allbery <rra@cpan.org>
# Copyright 2013
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
t/pag/basic.t view on Meta::CPAN
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.010;
use strict;
use warnings;
use lib 't/lib';
use Test::RRA qw(use_prereq);
BEGIN { use_prereq('IPC::System::Simple', qw(capturex systemx)) }
# Establish the plan now that we know we're continuing.
use Test::More tests => 6;
# Load the module.
BEGIN { use_ok('AFS::PAG', qw(hasafs haspag setpag unlog)) }
# Determines if the user has valid tokens by running tokens.
#
# Returns: True if the user has valid tokens, false if not or if tokens fails
sub has_tokens {
my $tokens = eval { capturex('tokens') };
if (!$@ && $tokens =~ m{ [ ] tokens [ ] for [ ] }xmsi) {
t/pag/isolation.t view on Meta::CPAN
#!/usr/bin/perl
#
# Test that creating a PAG isolates token changes from the caller
#
# Written by Russ Allbery <rra@cpan.org>
# Copyright 2013
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
t/pag/isolation.t view on Meta::CPAN
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.010;
use autodie;
use strict;
use warnings;
use lib 't/lib';
use Test::RRA qw(use_prereq);
BEGIN { use_prereq('IPC::System::Simple', qw(capturex systemx)) }
# Establish the plan now that we know we're continuing.
use Test::More tests => 3;
# Load the module.
BEGIN { use_ok('AFS::PAG', qw(hasafs setpag unlog)) }
# Determines if the user has valid tokens by running tokens.
#
# Returns: True if the user has valid tokens, false if not or if tokens fails
sub has_tokens {
my $tokens = eval { capturex('tokens') };
if (!$@ && $tokens =~ m{ [ ] tokens [ ] for [ ] }xmsi) {
t/style/coverage.t view on Meta::CPAN
#!/usr/bin/perl
#
# Test Perl code for test coverage.
#
# The canonical version of this file is maintained in the rra-c-util package,
# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
t/style/coverage.t view on Meta::CPAN
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use File::Spec;
use Test::More;
use Test::RRA qw(skip_unless_author use_prereq);
use Test::RRA::Config qw($COVERAGE_LEVEL @COVERAGE_SKIP_TESTS);
# Skip code coverage unless author tests are enabled since it takes a long
# time, is sensitive to versions of various libraries, and does not detect
# functionality problems.
skip_unless_author('Coverage tests');
# Load prerequisite modules.
use_prereq('Devel::Cover');
use_prereq('Test::Strict');
# Build a list of test directories to use for coverage.
my %ignore = map { $_ => 1 } qw(data docs style), @COVERAGE_SKIP_TESTS;
opendir(my $testdir, 't') or BAIL_OUT("cannot open t: $!");
my @t_dirs = readdir($testdir) or BAIL_OUT("cannot read t: $!");
closedir($testdir) or BAIL_OUT("cannot close t: $!");
# Filter out ignored and system directories.
@t_dirs = grep { !$ignore{$_} } File::Spec->no_upwards(@t_dirs);
# Prepend the t directory name to the directories.
@t_dirs = map { File::Spec->catfile('t', $_) } @t_dirs;
# Disable POD coverage; that's handled separately and is confused by
# autoloading.
$Test::Strict::DEVEL_COVER_OPTIONS
= '-coverage,statement,branch,condition,subroutine';
# Do the coverage analysis.
all_cover_ok($COVERAGE_LEVEL, @t_dirs);
# Hack to suppress "used only once" warnings.
END { $Test::Strict::DEVEL_COVER_OPTIONS = q{} }
t/style/critic.t view on Meta::CPAN
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use Test::RRA qw(skip_unless_author use_prereq);
use Test::RRA::Config qw(@CRITIC_IGNORE);
# Skip tests unless we're running author tests since this test is too
# sensitive to the exact version of Perl::Critic to be generally useful.
skip_unless_author('Coding style tests');
# Load prerequisite modules.
use_prereq('Perl::Critic::Utils');
use_prereq('Test::Perl::Critic');
# Force the embedded Perl::Tidy check to use the correct configuration.
local $ENV{PERLTIDY} = 't/data/perltidyrc';
# Import the configuration file and run Perl::Critic.
Test::Perl::Critic->import(-profile => 't/data/perlcriticrc');
# By default, Test::Perl::Critic only checks blib. We also want to check t,
# Build.PL, and examples.
my @files = Perl::Critic::Utils::all_perl_files('blib');
if (!@files) {
@files = Perl::Critic::Utils::all_perl_files('lib');
}
if (-f 'Build.PL') {
push(@files, 'Build.PL');
}
for my $dir (qw(examples usr t)) {
if (-d $dir) {
t/style/minimum-version.t view on Meta::CPAN
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use Test::RRA qw(skip_unless_automated use_prereq);
use Test::RRA::Config qw($MINIMUM_VERSION);
# Skip for normal user installs since this doesn't affect functionality.
skip_unless_automated('Minimum version tests');
# Load prerequisite modules.
use_prereq('Test::MinimumVersion');
# Check all files in the Perl distribution.
all_minimum_version_ok($MINIMUM_VERSION);
t/style/strict.t view on Meta::CPAN
#!/usr/bin/perl
#
# Test Perl code for strict, warnings, and syntax.
#
# The canonical version of this file is maintained in the rra-c-util package,
# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
t/style/strict.t view on Meta::CPAN
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
use 5.006;
use strict;
use warnings;
use lib 't/lib';
use File::Spec;
use Test::RRA qw(skip_unless_automated use_prereq);
# Skip for normal user installs since this doesn't affect functionality.
skip_unless_automated('Strictness tests');
# Load prerequisite modules.
use_prereq('Test::Strict');
# Test everything in the distribution directory except the Build and
# Makefile.PL scripts generated by Module::Build. We also want to check use
# warnings.
$Test::Strict::TEST_SKIP = ['Build', 'Makefile.PL'];
$Test::Strict::TEST_WARNINGS = 1;
all_perl_files_ok(File::Spec->curdir);
# Hack to suppress "used only once" warnings.
END {
$Test::Strict::TEST_SKIP = [];
$Test::Strict::TEST_WARNINGS = 0;
}