Test::Builder::Formatter - Base class for formatters
Results go to Test::Builder::Stream which then forwards them on to one or more formatters. This module is a base class for formatters. You do not NEED to use this module to write a formatter, but it can help.
[Test Script] > [Test Tool] > [Test::Builder] > [Test::Bulder::Stream] > [Result Formatter] ^ You are here
A test script uses a test tool such as Test::More, which uses Test::Builder to produce results. The results are sent to Test::Builder::Stream which then forwards them on to one or more formatters. The default formatter is Test::Builder::Fromatter::TAP which produces TAP output.
package My::Formatter; use base 'Test::Builder::Formatter'; sub ok { my $self = shift; my ($result) = @_; ... } ... 1;
use Test::More; use My::Formatter; # Creates a new instance of your listener. Any params you pass in will be # passed into the constructor. Exceptions: 'id', 'stream' and 'tb' which # are used directly by 'listen' if present. my $unlisten = My::Formatter->listen(...); # To stop listening: $unlisten->();
Create a new instance. Arguments must be key => value pairs where the key is a method name on the object.
Construct an instance using %params, and add it as a listener on the stream. 'id', 'stream', and 'tb' are special arguments that can be used to specify the id of the listener, the stream to which the instance will listen, or the Test::Builder instance from which to find the stream.
Forward the resutl on to the correct method.
Returns an anonymous sub that accepts results as arguments and passes them into handle() on this instance.
Any results given to the handle() method will be passed into the associated sub. If the sub is not defined then results of that type will be ignored.
The source code repository for Test::More can be found at http://github.com/Test-More/test-more/.
Copyright 2014 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://www.perl.com/perl/misc/Artistic.html
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.