Test::If(3pm)

πŸ“¦
version 0.01 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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 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