events - Execute load_module_*() and dump the generated events.
events load_module_ok Bad::Module -diag Fubar events ok 1 "I'm OK, you're OK" events -help events -version
If this Boolean option is asserted, the first argument is interpreted as the name of a method attached to a context object. The context will be acquired, the method executed, and the context released.
Subsequent arguments are passed verbatim to the method, followed by the -name and -diagnostic options in that order.
The context's ok() method is special-cased to handle the fact that it takes diagnostics as an array reference rather than an array. Any other methods that take structured arguments (e.g. send_ev2() will flunk.
ok()
send_ev2()
-diagnostic 'This is a diagnostic'
This option specifies a diagnostic. It can be specified more than once.
This option displays the documentation for this script. The script then exits.
This option specifies an explicit import. It can be specified more than once. A value of '[]' specifies an empty array reference as the argument.
'[]'
This option specifies the name argument.
-skip 17
This option specifies the number of skipped tests for load_module_or_skip(). This is actually a synonym for -diagnostic, since the two arguments are handled the same way.
load_module_or_skip()
This option specifies a version number for the module.
This Perl script executes a test subroutine and dumps the events generated by it. Note that test diagnostics will not appear in the dump if they are attached as info. It is specialized for use with Test2::Tools::LoadModule, but can handle any Test2::V0 routine that generates events.
info
The command-line arguments are the subroutine to call, and any required arguments of that subroutine. We assume that any subroutine we are interested in takes an optional name and optional diagnostics, provided by the -name and -diagnostic options, respectively.
If the subroutine was found in Test2::Tools::LoadModule, we assume it requires one additional mandatory argument (the module name), followed by the -version, -import, -name, and -diagnostic options in that order. Otherwise we assume it takes all command-line arguments as specified, followed by the -name and -diagnostic options in that order.
This must be load_module_ok, load_module_or_skip, load_module_or_skip_all, require_ok, or use_ok.
load_module_ok
load_module_or_skip
load_module_or_skip_all
require_ok
use_ok
The subsequent subroutine arguments are specified by options. In order, they are
Thomas R. Wyant, III wyant at cpan dot org
Copyright (C) 2020-2021 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Test2::Tools::LoadModule, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test2::Tools::LoadModule
CPAN shell
perl -MCPAN -e shell install Test2::Tools::LoadModule
For more information on module installation, please visit the detailed CPAN module installation guide.