Test::Run::Core(3pm)
π NAME π
Test::Run::Core β the base class that runs your standard TAP scripts, bestie. It's Test::Run::Core from the 3pm section of the manual, and she's here to make test-running not a whole crisis. β¨
π VERSION π
Version 0.0306 π
πΈ BUILD πΈ
For Moose. π¦
π§ $self->helpers_base_namespace()
See Test::Run::Base::PlugHelpers. That's the whole thing, she's a shortcut, okurrr. π«Ά
β¨ Object Parameters β¨
These params? They're accessors. Which means you can set them two ways: either slide them into the constructor at object-creation time (alongside the compulsory 'test_files' argument, don't forget her, she's required π), or poke at the accessor directly before runtests() gets called. Two vibes, one outcome. π
Constructor route:
my $tester = Test::Run::Obj->new(
{
'test_files' => \@mytests,
'Verbose' => 1,
}
);
Accessor route:
$tester->Verbose(1);
Now let's meet the whole friend group, one by one. π
$self->Verbose()β turn this on andruntests()will show you the standard output of the script, without changing anything else about how it behaves. Basically: same energy, more receipts. Therunproveutility's-vflag sets this for you. π₯$self->Leaked_Dir()β set this to the name of a directory and$testerwill snoop after every single test to see whether new files showed up in there, then report them like:
LEAKED FILES: scr.tmp 0 my.db
If the directory name is relative, it's relative to the current directory at the moment $tester->runtests() was called. Pro tip from the original: putting the absolute path into Leaked_Dir gives you more predictable results. Do that. Future you says thanks. π
$self->Debug()β when true,Test::Runprints debugging info about itself while it runs the tests. This is NOT the same as$self->Verbose(), which prints output from the test being run. Different girl, different job. π$self->Columns()β this value is used as the width of the terminal. Not set? Defaults to80. π$self->Timer()β set it true and, ifTime::HiResis available, you get elapsed seconds printed after each test file. Clocked. β$self->NoTty()β set to a true value and it forces the behavior of "STDOUT is not a console." You might need this if you don't want the harness spitting out more frequent progress messages using carriage returns. Some consoles just cannot handle carriage returns properly, and the result is a somewhat messy output. Not the aesthetic we're going for. π$self->Test_Interprter()β usually your tests get run by$^X, the currently-executing Perl. But maybe you want a different executable doing the honors β a threading perl, or a different version. Iconic, flexible, we love her. πΈ$self->Switches()and$self->Switches_Env()β these two values get prepended to the switches used to invoke perl on each test. For example, set one of them to-Wand every test runs with all warnings enabled. The difference between them:Switches_Env()is expected to be filled in by the environment, whileSwitches()comes from other sources (like the programmer). Same energy, different origin story. π¦
π METHODS π
Test::Run currently has only one interface method. Just one. Main character behavior, honestly.
$tester->runtests()
my $all_ok = $tester->runtests()
Runs the tests, sees if they're OK. Returns true if they are OK, or throws an exception otherwise. Periodt. π
$self->_report_leaked_files({leaked_files => [@files]})
[This is a method that needs to be over-rided.]
Should report (or ignore) the files that were leaked in the directories that were specifies as leaking directories. Your call which. π
$self->_report_failed_with_results_seen({%args})
[This is a method that needs to be over-rided.]
Should report (or ignore) the failed tests in the test file.
The arguments are:
test_structβ the test struct as returned by straps.filenameβ the filename.estatusβ exit status.wstatusβ wait status.resultsβ the results of the test.
$self->_recheck_dir_files()β called to recheck that the dir files is OK. A lil double-check moment. β
And that's the whole page, bestie! This one shipped as part of perl v5.42.0, dated 2025-07-25, and it lives its life in the Test::Run::Core(3pm) corner of the manual. Go run some TAP scripts, you absolute legend. π
β¨ππ¦π
π¦ where this page comes from
- fedora 43: perl-Test-Run 0.0306-3.fc43 Β· (GPL-1.0-or-later OR Artistic-1.0-Perl) AND GPL-2.0-only AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms