Involved Projects and Packages
This class provides a set of assertion methods useful for writing tests.
The API is based on JUnit4 and the Test::Unit::Lite manpage and the methods
die on failure.
These assertion methods might be not useful for common the Test::Builder
manpage-based (the Test::Simple manpage, the Test::More manpage, etc.) test
units.
The assertion methods can be used in class which is derived from
'Test::Assert' or used as standard Perl functions after importing them into
user's namespace.
'Test::Assert' can also wrap standard the Test::Simple manpage, the
Test::More manpage or other the Test::Builder manpage-based tests.
The assertions can be also used for run-time checking.
This module checks that you _Changes_ file has an entry for the current
version of the *Module* being tested.
The version information for the distribution being tested is taken out of
the Build data, or if that is not found, out of the Makefile.
It then attempts to open, in order, a file with the name _Changes_ or
_CHANGES_.
The _Changes_ file is then parsed for version numbers. If one and only one
of the version numbers matches the test passes. Otherwise the test fails.
A message with the current version is printed if the test passes, otherwise
dialog messages are printed to help explain the failure.
The _examples_ directory contains examples of the different formats of
_Changes_ files that are recognized.
'Test::Command' intends to bridge the gap between the well tested functions
and objects you choose and their usage in your programs. By examining the
exit status, terminating signal, STDOUT and STDERR of your program you can
determine if it is behaving as expected.
This includes testing the various combinations and permutations of options
and arguments as well as the interactions between the various functions and
objects that make up your program.
The various test functions below can accept either a command string or an
array reference for the first argument. If the command is expressed as a
string it is passed to 'system' as is. If the command is expressed as an
array reference it is dereferenced and passed to 'system' as a list. See
''perldoc -f system'' for how these may differ.
The final argument for the test functions, '$name', is optional. By default
the '$name' is a concatenation of the test function name, the command
string and the expected value. This construction is generally sufficient
for identifying a failing test, but you may always specify your own '$name'
if desired.
Any of the test functions can be used as instance methods on a
'Test::Command' object. This is done by dropping the initial '$cmd'
argument and instead using arrow notation.
All of the following 'exit_is_num' calls are equivalent.
exit_is_num('true', 0);
exit_is_num('true', 0, 'exit_is_num: true, 0');
exit_is_num(['true'], 0);
exit_is_num(['true'], 0, 'exit_is_num: true, 0');
my $cmd = Test::Command->new( cmd => 'true' );
exit_is_num($cmd, 0);
exit_is_num($cmd, 0, 'exit_is_num: true, 0');
$cmd->exit_is_num(0);
$cmd->exit_is_num(0, 'exit_is_num: true, 0');
$cmd = Test::Command->new( cmd => ['true'] );
exit_is_num($cmd, 0);
exit_is_num($cmd, 0, 'exit_is_num: true, 0');
$cmd->exit_is_num(0);
$cmd->exit_is_num(0, 'exit_is_num: true, 0');
This module was written to ensure that a META.yml file, provided with a
standard distribution uploaded to CPAN, meets the specifications that are
slowly being introduced to module uploads, via the use of package makers
and installers such as the ExtUtils::MakeMaker manpage, the Module::Build
manpage and the Module::Install manpage.
See the CPAN::Meta manpage for further details of the CPAN Meta
Specification.
This module scans your project/distribution for any perl files (scripts,
modules, etc) for the presence of windows line endings.
Do you wanna check that every one of your Perl modules in a distribution
has a version number? You wanna make sure you don't forget the brand new
modules you just added? Well, that's the module you have been looking for.
Use it!
Do you wanna check someone else's distribution to make sure the author have
not commited the sin of leaving Perl modules without a version that can be
used to tell if you have this or that feature? 'Test::HasVersion' is also
for you, nasty little fellow.
There's a script _test_version_ which is installed with this distribution.
You may invoke it from within the root directory of a distribution you just
unpacked, and it will check every _.pm_ file in the directory and under
_lib/_ (if any).
$ test_version
You may also provide directories and files as arguments.
$ test_version *.pm lib/ inc/
$ test_version .
(Be warned that many Perl modules in a _t/_ directory do not receive
versions because they are not used outside the distribution.)
Ok. That's not a very useful module by now. But it will be. Wait for the
upcoming releases.
FUNCTIONS
* PRIVATE *_pm_version*
$v = _pm_version($pm);
Parses a PM file and return what it thinks is $VERSION in this file.
(Actually implemented with 'use ExtUtils::MakeMaker;
MM->parse_version($file)'.) '$pm' is the filename (eg.,
_lib/Data/Dumper.pm_).
* *pm_version_ok*
pm_version_ok('Module.pm');
pm_version_ok('M.pm', 'Has valid version');
Checks to see if the given file has a valid version. Actually a valid
version number is defined and not equal to ''undef'' (the string)
which is return by '_pm_version' if a version cannot be determined.
* *all_pm_version_ok*
all_pm_version_ok();
all_pm_version_ok(@PM_FILES);
Checks every given file and _.pm_ files found under given directories
to see if they provide valid version numbers. If no argument is
given, it defaults to check every file _*.pm_ in the current
directory and recurses under the _lib/_ directory (if it exists).
If no test plan was setted, 'Test::HasVersion' will set one after
computing the number of files to be tested. Otherwise, the plan is
left untouched.
* PRIVATE *_list_pm_files*
@pm_files = _list_pm_files(@dirs);
Returns all PM files under the given directories.
* *all_pm_files*
@files = all_pm_files()
@files = all_pm_files(@files_and_dirs);
Implements finding the Perl modules according to the semantics of the
previous function 'all_pm_version_ok'.
This module scans your project/distribution for any perl files (scripts,
modules, etc) for the presence of tabs.
Test::Synopsis is an (author) test module to find .pm or .pod files under
your _lib_ directory and then make sure the example snippet code in your
_SYNOPSIS_ section passes the perl compile check.
Note that this module only checks the perl syntax (by wrapping the code
with 'sub') and doesn't actually run the code.
Suppose you have the following POD in your module.
=head1 NAME
Awesome::Template - My awesome template
=head1 SYNOPSIS
use Awesome::Template;
my $template = Awesome::Template->new;
$tempalte->render("template.at");
=head1 DESCRIPTION
An user of your module would try copy-paste this synopsis code and find
that this code doesn't compile because there's a typo in your variable name
_$tempalte_. Test::Synopsis will catch that error before you ship it.
Throwable is a role for classes that are meant to be thrown as exceptions
to standard program flow. It is very simple and does only two things: saves
any previous value for '$@' and calls 'die $self'.
Time::Duration::Parse is a module to parse human readable duration strings
like _2 minutes and 3 seconds_ to seconds.
It does the opposite of _duration_exact_ function in Time::Duration and is
roundtrip safe. So, the following is always true.
use Time::Duration::Parse;
use Time::Duration;
my $seconds = int rand 100000;
is( parse_duration(duration_exact($seconds)), $seconds );
PyYAML is the most robust and correct YAML module for a dynamic language.
It is (obviously) written in/for Python. This module is a complete port of
PyYAML to Perl.