Test::...Pattern(3pm)

πŸ“¦
version 0.010 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸŽ€ NAME πŸŽ€

Okay bestie, welcome to the manual page for Test::Regexp::Pattern πŸ’– β€” that's the 3pm one, from the User Contributed Perl Documentation. And what does it do?? It tests your Regexp::Pattern patterns. Yeah. It's a whole vibe check for your regexps. Periodt.


✨ VERSION ✨

This doc describes version 0.010 of Test::Regexp::Pattern β€” that's from the Perl distribution Test-Regexp-Pattern, released on 2022-07-24. Mark your calendars, she's stable. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

So like, first scenario: you wanna check all the regexp patterns in one module. Do this:

use Test::Regexp::Pattern;
regexp_patterns_in_module_ok("Foo::Bar", {opt => ...}, $msg);

Or alternatively 🫢 β€” and this is the distro-wide energy β€” you can check all regexp patterns in all the modules across your whole distro:

# save in release-regexp-pattern.t, put in distro's t/ subdirectory
use Test::More;
plan skip_all => "Not release testing" unless $ENV{RELEASE_TESTING};
eval "use Test::Regexp::Pattern";
plan skip_all => "Test::Regexp::Pattern required for testing Regexp::Pattern patterns" if $@;
regexp_patterns_in_all_modules_ok({opt => ...}, $msg);

Slay. πŸ”₯


🌸 DESCRIPTION 🌸

So this module runs various checks on a module's Regexp::Pattern patterns. That's the whole job, and she does it well.

The recommendation, lowkey strongly: if you add regexp patterns to your code, include something like that release-regexp-pattern.t up there in your distribution. Iconic move.

And ohh, if you build your distribution with Dist::Zilla, there's already a [Regexp::Pattern] plugin that automatically adds this release test file during build for you. No cap, it just handles it. 🧚


πŸ’œ ACKNOWLEDGEMENTS πŸ’œ

Some code was taken from Test::Pod::Coverage by Andy Lester. Giving credit where it's due, always. 🫢


⭐ FUNCTIONS ⭐

Heads up: all of these functions are exported by default. You don't gotta ask nicely. ✨

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

Load $module and perform the test for regexp patterns (%RE) in that module. Simple as that.

Available options:

  • test_examples => bool β€” and the default is 1. So she's on by default, bestie.

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

Look for modules in the directory lib β€” or, plot twist, in blib instead if it exists πŸ‘€ β€” and then run regexp_patterns_in_module_ok() against each and every one of them. All of them. Everyone gets tested.

Options are the exact same as in regexp_patterns_in_module_ok().


🌈 HOMEPAGE 🌈

Please visit the project's homepage at https://metacpan.org/release/Test-Regexp-Pattern. Go say hi. πŸ’–


πŸ¦‹ SOURCE πŸ¦‹

Source repository lives at https://github.com/perlancar/perl-Test-Regexp-Pattern. Come lurk, come contribute.


πŸ‘‘ SEE ALSO πŸ‘‘

  • test-regexp-pattern β€” a command-line interface for regexp_patterns_in_all_modules_ok(). CLI girlies, this one's for you.
  • Regexp::Pattern
  • Dist::Zilla::Plugin::Regexp::Pattern

πŸ’… AUTHOR πŸ’…

perlancar <perlancar@cpan.org> β€” the main character, honestly. πŸ‘‘


🫢 CONTRIBUTING 🫢

Wanna help out?? You absolutely can:

  • Send patches by email / via RT, or
  • Send pull requests on GitHub.

And here's the tea: most of the time, you don't need to build the distribution yourself. You can literally just modify the code, then test it via:

% prove -l

That's it. That's the workflow. 😌

But if you do want to build the distribution (like, say, to try installing it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin.

Any additional steps required beyond all that are considered a bug, and you can report them to me. Fr fr.

This software is copyright (c) 2022, 2020, 2018 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. Free as in go off. πŸ’–


πŸ’€ BUGS πŸ’€

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

And when you're submitting a bug or request, please include a test-file, or a patch to an existing test-file, that illustrates the bug or the desired feature. Because not me getting a report with zero repro steps 😭 β€” help a sister out, bestie.


And that's the page!! πŸŽ€ Wrapped up for you on 2022-10-08 by perl v5.36.0, which is what produced this particular Test::...Pattern(3pm) rendering. Mwah. πŸ’‹βœ¨

πŸ“¦ where this page comes from