App-DocKnot

 view release on metacpan or  search on metacpan

t/lib/Test/RRA/Config.pm  view on Meta::CPAN

if (!defined($PATH)) {
    BAIL_OUT('cannot find data/perl.conf');
}

# Pre-declare all of our variables and set any defaults.
our $COVERAGE_LEVEL = 100;
our @COVERAGE_SKIP_TESTS;
our @CRITIC_IGNORE;
our $LIBRARY_PATH;
our $MINIMUM_VERSION = '5.012';
our %MINIMUM_VERSION;
our @MODULE_VERSION_IGNORE;
our @POD_COVERAGE_EXCLUDE;
our @SPDX_IGNORE;
our @STRICT_IGNORE;
our @STRICT_PREREQ;

# Load the configuration.
if (!do($PATH)) {
    my $error = $@ || $! || 'loading file did not return true';
    BAIL_OUT("cannot load $PATH: $error");
}

1;
__END__

=for stopwords
Allbery rra-c-util Automake perlcritic .libs namespace subdirectory sublicense
MERCHANTABILITY NONINFRINGEMENT regexes SPDX

=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
C_TAP_BUILD or C_TAP_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.

=item @CRITIC_IGNORE

Additional files or directories to ignore when doing recursive perlcritic
testing.  To ignore files that will be installed, the path should start with
F<blib>.

=item $LIBRARY_PATH

Add this directory (or a F<.libs> subdirectory) relative to the top of the
source tree to LD_LIBRARY_PATH when checking the syntax of Perl modules.  This
may be required to pick up libraries that are used by in-tree Perl modules so
that Perl scripts can pass a syntax check.

=item $MINIMUM_VERSION

Default minimum version requirement for included Perl scripts.  If not given,
defaults to 5.010.

=item %MINIMUM_VERSION

Minimum version exceptions for specific directories.  The keys should be
minimum versions of Perl to enforce.  The value for each key should be a
reference to an array of either top-level directory names or directory names
starting with F<tests/>.  All files in those directories will have that
minimum Perl version constraint imposed instead of $MINIMUM_VERSION.

=item @MODULE_VERSION_IGNORE

File names to ignore when checking that all modules in a distribution have the
same version.  Sometimes, some specific modules need separate, special version
handling, such as modules defining database schemata for DBIx::Class, and
can't follow the version of the larger package.

=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 @SPDX_IGNORE

Regexes that match files that should be excluded from SPDX license header
checks, in addition to the standard exclusions.  The regular expression is
matched against the file path relative to the top of the source tree.

=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/>.



( run in 2.353 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )