Test::Rinci - Test Rinci metadata
This document describes version 0.155 of Test::Rinci (from Perl distribution Test-Rinci), released on 2020-09-23.
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);
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.
release-rinci.t
Some code taken from Test::Pod::Coverage by Andy Lester.
All these functions are exported by default.
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.
$module
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.
main
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
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.
test_function_metadata
wrap_functions
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.
Look for modules in directory lib (or blib instead, if it exists), and run metadata_in_module_ok() on each of them.
lib
blib
run metadata_in_module_ok()
Options are the same as in metadata_in_module_ok().
metadata_in_module_ok()
Please visit the project's homepage at https://metacpan.org/release/Test-Rinci.
Source repository is at https://github.com/perlancar/perl-Test-Rinci.
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.
test-rinci, a command-line interface for metadata_in_all_modules_ok().
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
perlancar <perlancar@cpan.org>
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.
To install Test::Rinci, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Rinci
CPAN shell
perl -MCPAN -e shell install Test::Rinci
For more information on module installation, please visit the detailed CPAN module installation guide.