The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Sah::Schema - Test Sah::Schema::* modules in distribution

VERSION

This document describes version 0.016 of Test::Sah::Schema (from Perl distribution Test-Sah-Schema), released on 2023-09-03.

SYNOPSIS

To check a single Sah::Schema::* module:

 use Test::Sah::Schema tests=>1;
 sah_schema_module_ok("Sah::Schema::Foo", {opt => ...}, $msg);

To check all Sah::Schema::* modules in a distro:

 # save in release-sah-schema.t, put in distro's t/ subdirectory
 use Test::More;
 plan skip_all => "Not release testing" unless $ENV{RELEASE_TESTING};
 eval "use Test::Sah::Schema";
 plan skip_all => "Test::Sah::Schema required for testing Sah::Schema modules" if $@;
 sah_schema_modules_ok({opt => ...}, $msg);

DESCRIPTION

This module performs various checks on Sah::Schema::* modules. It is recommended that you include something like release-sah-schema.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::Sah::Schemas 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.

sah_schema_module_ok($module [, \%opts ] [, $msg])

Load $module, get its $schema, and perform test on it.

Available options:

  • test_schema_examples => BOOL (default: 1)

    Whether to test examples in schema.

sah_schema_modules_ok([ \%opts ] [, $msg])

Look for modules in directory lib (or blib instead, if it exists), and run sah_schema_module_ok() on each of them.

Options are the same as in sah_schema_module_ok(), plus:

  • include_modules

  • exclude_modules

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Test-Sah-Schema.

SOURCE

Source repository is at https://github.com/perlancar/perl-Test-Sah-Schema.

SEE ALSO

test-sah-schema, a command-line interface for sah_schema_modules_ok().

Test::Sah to use Sah schema to test data.

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023, 2022, 2020 by perlancar <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.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Sah-Schema

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.