Test2:...::Tiny(3perl)
β¨ NAME β¨
Test2::Tools::Tiny β the tiniest little toolkit for the unfortunate souls out there who literally cannot use Test2::Suite ππ
π«Ά DESCRIPTION π«Ά
okay bestie, real talk: you should actually be using Test2::Suite. like, genuinely. This package is just the bare-minimum essentials implemented using Test2, and it only exists so that Test2 and the other stuff Test2::Suite depends on can get tested. fr fr, this is the package Test2 uses to test itself. it's giving "emergency backup tools," not "main character energy." π
π USE Test2::Suite INSTEAD π
Use Test2::Suite if at all possible. that's it, that's the whole section. periodt. β¨
πΈ EXPORTS πΈ
ok($bool, $name)ok($bool, $name, @diag)
Run a simple assertion. basic. iconic. no notes. π
is($got, $want, $name)is($got, $want, $name, @diag)
Assert that 2 strings are the same. twin energy, matching strings only π₯
isnt($got, $do_not_want, $name)isnt($got, $do_not_want, $name, @diag)
Assert that 2 strings are not the same. respectfully, they're different π
like($got, $regex, $name)like($got, $regex, $name, @diag)
Check that the input string matches the regex. it slays, it fits the pattern π
unlike($got, $regex, $name)unlike($got, $regex, $name, @diag)
Check that the input string does not match the regex. wrong vibe, rejected π
is_deeply($got, $want, $name)is_deeply($got, $want, $name, @diag)
Check 2 data structures.
β οΈ heads up bestie: please note that this is a DUMB implementation that compares the output of Data::Dumper against both structures. no cap, that's genuinely the whole strategy. π§
diag($msg)
Issue a diagnostics message to STDERR. screaming into the error void π’
note($msg)
Issue a diagnostics message to STDOUT. gentle journaling, but public π
skip_all($reason)
Skip all tests. not me dodging the entire suite π
todo $reason => sub { ... }
Run a block in TODO mode. it's giving "we'll get to it," and honestly that's valid π¦
plan($count)
Set the plan.
done_testing()
Set the plan to the current test count. we're done and we're proud β¨
$warnings = warnings { ... }
Capture an arrayref of warnings from the block. hoarding the red flags in an arrayref, as one does π
$exception = exception { ... }
Capture an exception. gotcha, caught you π
tests $name => sub { ... }
Run a subtest. a test inside a test, inception but make it cute πΈ
$output = capture { ... }
Capture STDOUT and STDERR output.
Result looks like this:
{
STDOUT => "...",
STDERR => "...",
}
π SOURCE π
The source code repository for Test2 can be found at <https://github.com/Test-More/test-more/>. go look, it's there, iykyk π«Ά
π 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 <https://dev.perl.org/licenses/>
okay that's the whole thing bestie, documented and devoured ππ
this was perl v5.44.0, dated 2026-10-17, for Test2:...::Tiny(3perl) β stay tiny, stay iconic, and please go use Test2::Suite fr fr πβ¨π¦
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms