Debian Codegraph @

README

raw
1 NAME
2 Test::If - Test only if ...
3
4 VERSION
5 Version 0.01
6
7 SYNOPSIS
8 Generic usage
9
10 use Test::More;
11 use Test::If 'Test::Something', [ tests => N ];
12
13 # Is equal to
14
15 use Test::More;
16 eval q{ use Test::Something; 1 } or plan skip_all => 'Module Test::Something required for this test';
17 plan tests => N;
18
19
20 use Test::More;
21 use Test::If sub { $ENV{TEST_AUTHOR} }, [ tests => N ];
22
23 # Is equal to
24
25 use Test::More;
26 $ENV{TEST_AUTHOR} or plan skip_all => "Test condition not met";
27 plan tests => N;
28
29 You can also combine options and it is allowed to omit plan options, if
30 it is runned by loaded module or you want to load it manually
31
32 For example common "pod-coverage.t":
33
34 use Test::More;
35 use Test::If
36 sub { $ENV{TEST_AUTHOR} }, # Checked first $ENV{TEST_AUTHOR}, otherwise skip
37 'Test::Pod::Coverage 1.08', # Use Test::Pod::Coverage of at least version 1.08
38 'Pod::Coverage 0.18', # And want Pod::Coverage at least of version 0.18
39 ;
40
41 all_pod_coverage_ok();
42
43 If some of conditions will not be met, test will be skipped.
44
45 AUTHOR
46 Mons Anderson, "<mons at cpan.org>"
47
48 COPYRIGHT & LICENSE
49 Copyright 2009 Mons Anderson, all rights reserved.
50
51 This program is free software; you can redistribute it and/or modify it
52 under the same terms as Perl itself.
53