Test::If(3pm)
β¨ NAME β¨
Test::If β test only if... π (yes, that's literally the whole name, she's mysterious like that)
π VERSION π
Version 0.01 β babes, this is a baby version number, treat her gently π«Ά
π SYNOPSIS π
okay so first up, the generic usage vibe, bestie β¨
use Test::More;
use Test::If 'Test::Something', [ tests => N ];
# Is equal to
use Test::More;
eval q{ use Test::Something; 1 } or plan skip_all => 'Module Test::Something required for this test';
plan tests => N;
use Test::More;
use Test::If sub { $ENV{TEST_AUTHOR} }, [ tests => N ];
# Is equal to
use Test::More;
$ENV{TEST_AUTHOR} or plan skip_all => "Test condition not met";
plan tests => N;
like. you could write all that eval q{ ... } and plan skip_all stuff yourself. but why. Test::If does it for you and she eats every single time π₯
You can also combine options, and it is allowed to omit plan options if it is run by the loaded module or you want to load it manually. no cap π
For example, the common "pod-coverage.t" π:
use Test::More;
use Test::If
sub { $ENV{TEST_AUTHOR} }, # Checked first $ENV{TEST_AUTHOR}, otherwise skip
'Test::Pod::Coverage 1.08', # Use Test::Pod::Coverage of at least version 1.08
'Pod::Coverage 0.18', # And want Pod::Coverage at least of version 0.18
;
all_pod_coverage_ok();
look at her. three conditions stacked, one call, main character energy only π
If some of conditions will not be met, test will be skipped. π¦
πΈ AUTHOR πΈ
Mons Anderson, "<mons at cpan.org>" β ty king, iconic behavior fr fr π
π COPYRIGHT & LICENSE π
Copyright 2009 Mons Anderson, all rights reserved. periodt. β¨
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, open source icon π
and that's the whole page bestie π«Ά this one's from perl v5.36.0, dated 2022-10-22, and it's filed under Test::If(3pm) β go forth and conditionally test, mwah ππ
π¦ where this page comes from
- ubuntu noble: libtest-if-perl 0.01-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-if-perl 0.01-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-if-perl 0.01-3 Β· Artistic-1.0-Perl OR 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