TITLE

events - Execute load_module_*() and dump the generated events.

SYNOPSIS

events load_module_ok Bad::Module -diag Fubar
events ok 1 "I'm OK, you're OK"
events -help
events -version

OPTIONS

-context

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.

-diagnostic

-diagnostic 'This is a diagnostic'

This option specifies a diagnostic. It can be specified more than once.

-help

This option displays the documentation for this script. The script then exits.

-import

This option specifies an explicit import. It can be specified more than once. A value of '[]' specifies an empty array reference as the argument.

-name

This option specifies the name argument.

-skip

-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.

-version

This option specifies a version number for the module.

DETAILS

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.

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.

The subroutine to execute

This must be load_module_ok, load_module_or_skip, load_module_or_skip_all, require_ok, or use_ok.

The name of the module to load

The subsequent subroutine arguments are specified by options. In order, they are

-version
-import
-name
-diagnostic or -skip.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2020-2022 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.