Fennec::Finder(3pm)

πŸ“¦
version 2.018 Β· 2 versions
  • 2.018 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 2.018 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Fennec::Finder β€” the manual page, bestie edition πŸ’–

So this is Fennec::Finder(3pm) from the User Contributed Perl Documentation section, and it's genuinely giving "one file to rule them all" energy. ✨


πŸŽ€ NAME πŸŽ€

Fennec::Finder β€” create one .t file to find all .pm test files. That's it. That's the whole vibe. πŸ’…


🌸 DESCRIPTION 🌸

Okay so storytime: back in the day, Fennec used to use a runner that got loaded up inside t/Fennec.t and that runner went hunting around for test files (aka modules) to run. Cute, but a lot.

This module does the same kinda thing but greatly simplified β€” like, same job, way less drama. πŸ¦‹


✨ SYNOPSIS ✨

Your Fennec.t should look like this, no cap:

#!/usr/bin/perl
use strict;
use warnings;

use Fennec::Finder;

run();

So what does that actually do? It finds all the .pm and .ft files chilling under t/ and loads them. πŸ“‚ Any of those files that contain Fennec tests will register themselves to be run the moment you call run(). Iconic behaviour honestly.

⚠️ Warning bestie, read this one: if you've got .pm files sitting in t/ that are not tests, they're gonna get loaded too. And if any of those have interactions with the packages you're testing, you must account for them. Not me warning you about your own directory layout 😭

πŸ’œ CUSTOMISATIONS πŸ’œ

πŸ” SEARCH PATHS πŸ”

When you do use Fennec::Finder;, the ./t/ directory gets searched if it exists. If it doesn't? Then ./ gets used instead. Simple as that. 🫢

But you can optionally hand it alternate paths at use time, like:

use Fennec::Finder './Fennec', './SomeDir';

And in context, it looks like this:

#!/usr/bin/perl
use strict;
use warnings;

use Fennec::Finder './Fennec', './SomeDir';

run();

Look at you, customising. πŸ‘‘


βœ… FILE VALIDATION βœ…

Wanna control which files actually get loaded? Say less. You can subclass Fennec::Finder and override the validate_file( $file ) method. 🧚

Here's the tea on how it works:

  • It takes the filename to verify as an argument. πŸ“Ž
  • Return true if the file should be loaded.
  • Return false if it should not.

And currently? The only check it does is that the filename ends with a ".pm". That's it. That's the whole validation. Lowkey minimal, highkey works. πŸ’€


πŸ‘‘ AUTHORS πŸ‘‘

Chad Granum β€” exodist7@gmail.com


Copyright (C) 2013 Chad Granum

Fennec is free software; Standard perl license.

Fennec 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. See the license for more details. 🫑


And that's the whole page, bestie β€” you ate it. πŸ’–βœ¨

This little gem is documented as part of perl v5.36.0, dated 2022-12-02, and it's Fennec::Finder(3pm) β€” so go forth, make that one .t file, and let it find all your .pm test files for you. Slay. πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from