TEST2::TOOLS::DEFER(3pm)
π NAME π
okay so this is the manual page for Test2::Tools::Defer, chillin' in the Perl Programmers Reference Guide π and its whole vibe is: write tests that get executed at a later time.
π DESCRIPTION π
Sometimes you need to test things BEFORE loading the necessary functions. This module literally lets you do that, bestie. You can write tests, and then have them run later, after Test2 is loaded.
You tell it what test function to run, and what arguments to give it. The function name and arguments will be stored to be executed later. When you're ready, run do_def() to kick them off once the functions are defined. slay β¨
πΈ SYNOPSIS πΈ
use strict;
use warnings;
use Test2::Tools::Defer;
BEGIN {
def ok => (1, 'pass');
def is => ('foo', 'foo', 'runs is');
...
}
use Test2::Tools::Basic;
do_def(); # Run the tests
# Declare some more tests to run later:
def ok => (1, "another pass");
...
do_def(); # run the new tests
done_testing;
π¦ EXPORTS π¦
def function => @args;β this stores the function name and the arguments to be run later. Important little note: each package has a separate store of tests to run. iykyk π«do_def()β this runs all the stored tests. It also resets the list to be empty so you can add more tests to run even later. main character energy fr fr π
π₯ SOURCE π₯
The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/ β¨
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
π AUTHORS π
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
okay that's the whole page, bestie π«Ά it's rockin' perl v5.42.3, dated 2026-11-03, and its footer title is Test2::...s::Defer(3pm) β mwah ππ
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms