NAME
Test::Rinci - Test Rinci metadata
VERSION
This document describes version 0.155 of Test::Rinci (from Perl
distribution Test-Rinci), released on 2020-09-23.
SYNOPSIS
To check all metadata in a module:
use Test::Rinci tests=>1;
metadata_in_module_ok("Foo::Bar", {opt => ...}, $msg);
Alternatively, you can check all metadata in all modules in a distro:
# save in release-rinci.t, put in distro's t/ subdirectory
use Test::More;
plan skip_all => "Not release testing" unless $ENV{RELEASE_TESTING};
eval "use Test::Rinci";
plan skip_all => "Test::Rinci required for testing Rinci metadata" if $@;
metadata_in_all_modules_ok({opt => ...}, $msg);
DESCRIPTION
This module performs various checks on a module's Rinci metadata. It is
recommended that you include something like "release-rinci.t" in your
distribution if you add metadata to your code. If you use Dist::Zilla to
build your distribution, there is Dist::Zilla::Plugin::Test::Rinci to
make it easy to do so.
ACKNOWLEDGEMENTS
Some code taken from Test::Pod::Coverage by Andy Lester.
FUNCTIONS
All these functions are exported by default.
metadata_in_module_ok($module [, \%opts ] [, $msg])
Load $module, get its metadata, and perform test on all of them. For
function metadata, a wrapping to the function is done to see if it can
be wrapped.
Available options:
* load => BOOL (default: 1)
Set to false if you do not want to load the module, e.g. if you want
to test metadata in "main" package or if you have already loaded the
module yourself.
* test_package_metadata => BOOL (default: 1)
Whether to test package metadata found in module.
* exclude_packages => REGEX/ARRAY
List of packages to exclude from testing.
* test_function_metadata => BOOL (default: 1)
Whether to test function metadata found in module. Currently require
"wrap_function" option to be turned on, as the tests are done to the
metadata generated by the wrapper (for convenience, since the
wrapper can convert old v1.0 metadata to v1.1).
* wrap_function => BOOL (default: 1)
Whether to wrap function (using Perinci::Sub::Wrapper). All tests
which run module's functions require this option to be turned on.
* test_function_examples => BOOL (default: 1)
Whether to test examples in function metadata, by running each
example and comparing the specified result with actual result. Will
only take effect when "test_function_metadata" and "wrap_functions"
is turned on.
* exclude_functions => REGEX/ARRAY
List of functions to exclude from testing.
* test_variable_metadata => BOOL (default: 1)
Whether to test function metadata found in module.
* exclude_variables => REGEX/ARRAY
List of variables to exclude from testing.
metadata_in_all_modules_ok([ \%opts ] [, $msg])
Look for modules in directory "lib" (or "blib" instead, if it exists),
and "run metadata_in_module_ok()" on each of them.
Options are the same as in "metadata_in_module_ok()".
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/Test-Rinci>.
SOURCE
Source repository is at <https://github.com/perlancar/perl-Test-Rinci>.
BUGS
Please report any bugs or feature requests on the bugtracker website
<https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Rinci>
When submitting a bug or request, please include a test-file or a patch
to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
test-rinci, a command-line interface for "metadata_in_all_modules_ok()".
Test::Rinci::CmdLine and test-rinci-cmdline to test metadata inside
Perinci::CmdLine scripts.
Rinci
Perinci::Sub::Wrapper
Dist::Zilla::Plugin::Test::Rinci
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020, 2019, 2018, 2016, 2015, 2014, 2013,
2012 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.