App::Yath - Yet Another Test Harness, alternative to prove
This package implements the yath command line tool.
yath
yath [options] [files] [directories]
use App::Yath; my $yath = App::Yath->new(args => \@ARGV); my $exit = $yath->run(); exit($exit);
This minimal version is all most people will need. However it is recommended you use the complete form below. The complete form does a much better job of backing out of stack frames in preload+fork mode. Using the minimal can cause problems in some edge cases where tests assume there are no stack frames outside the test script itself.
use App::Yath; T2_DO_FILE: { my $yath = App::Yath->new(args => \@ARGV); my $exit = $yath->run(); exit($exit); } my $file = $Test2::Harness::Runner::DO_FILE or die "No file to run!"; # Test files do not always return a true value, so we cannot use require. We # also cannot trust $! package main; $@ = ''; do $file; die $@ if $@; exit 0;
In preload+fork mode the runner will attempt to break out to the T2_DO_FILE label. If the example above is inserted into your top-level script then the script will be able to run with minimal stack trace noise.
T2_DO_FILE
Add lib/ to @INC.
@INC
Add blib/lib and blib/arch to @INC.
Add directories to @INC.
Add a module to preload. (Prefork)
Add a renderer. "Test2::Harness::Renderer::$NAME" is implied. Prefix with '+' to give an absolute module name "+My::Name".
"Test2::Harness::Renderer::$NAME"
"+My::Name"
Add switches to use when executing perl.
Override the default color level. (0=off)
Show this usage help.
How many tests to run concurrently.
Merge STDERR and STDOUT from test files.
Do not use the default renderer.
Show every event, not just failures and diag.
Exclude any files that match the pattern.
Override the default parser. "Test2::Harness::Parser::$NAME" is implied. Prefix with '+' to give an absolute module name.
"Test2::Harness::Parser::$NAME"
Override the default runner. "Test2::Harness::Runner::$NAME" is implied. Prefix with '+' to give an absolute module name.
"Test2::Harness::Runner::$NAME"
Create a new instance. Accepts an array of command line arguments.
Args array passed into construction (was modified during construction.)
The Test2::Harness instance that will be used (configured during object construction).
The arrayref of files as processed/expanded from the command line arguments.
The arrayref of file exclusion patterns.
The arrayref of renders that are listening for events.
Run the tests, returns an integer that should be used as the exit code.
Used to load a module given in $name. $prefix is appended to the start of the module name unless $name begins with a '+' character.
$name
$prefix
Takes a list of filea and directories and expands it into a complete list of test files to run.
Prints the command line help and exits.
The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/.
Copyright 2016 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
To install Test2::Harness, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test2::Harness
CPAN shell
perl -MCPAN -e shell install Test2::Harness
For more information on module installation, please visit the detailed CPAN module installation guide.