|
NAMETest2::Tools - Documentation for Tools.DESCRIPTIONTools are packages that export test functions, typically all related to a specific aspect of testing. If you have a couple different categories of exports then you may want to break them into separate modules.Tools should export testing functions. Loading tools should not have side effects, or alter the behavior of other tools. If you want to alter behaviors or create side effects then you probably want to write a Test2::Plugin. FAQ
HOW DO I WRITE A 'TOOLS' MODULE?It is very easy to write tools:package Test2::Tools::Mine use strict; use warnings; # All tools should use the context() function. use Test2::API qw/context/; our @EXPORTS = qw/ok plan/; use base 'Exporter'; sub ok($;$) { my ($bool, $name) = @_; # All tool functions should start by grabbing a context my $ctx = context(); # The context is the primary interface for generating events $ctx->ok($bool, $name); # When you are done you release the context $ctx->release; return $bool ? 1 : 0; } sub plan { my ($max) = @_; my $ctx = context(); $ctx->plan($max); $ctx->release; } 1; See Test2::API::Context for documentation on what the $ctx object can do. SOURCEThe source code repository for Test2-Suite can be found at https://github.com/Test-More/Test2-Suite/.MAINTAINERS
AUTHORS
COPYRIGHTCopyright 2018 Chad Granum <exodist@cpan.org>.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/
Visit the GSP FreeBSD Man Page Interface. |