line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Effects::ONLY; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
989
|
no if $] >= 5.018, 'warnings', "experimental"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
87
|
use 5.014; |
|
1
|
|
|
|
|
12
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
106
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000001'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
129
|
sub import { $^H{'Test::Effects::ONLY'} = 1; } |
10
|
1
|
|
|
1
|
|
1951
|
sub unimport { $^H{'Test::Effects::ONLY'} = 0; } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
14
|
|
|
|
|
|
|
__END__ |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Test::Effects::ONLY - Lexically set Test::Effects verbosity |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 VERSION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This document describes Test::Effects::ONLY version 0.000001 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
use Test::Effects::ONLY; |
30
|
|
|
|
|
|
|
# Test::Effects defaults to only testing specified effects in this scope |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
no Test::Effects::ONLY; |
34
|
|
|
|
|
|
|
# Test::Effects defaults to testing all effects in this scope |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Test::Effects still only testing specified effects here |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
# Test::Effects reverts to original behaviour here |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Using this module changes the default behaviour of Test::Effects's |
46
|
|
|
|
|
|
|
C<effects_ok()> test. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Normally this test tests all side-effects, even those unspecified |
49
|
|
|
|
|
|
|
(unless explicitly told otherwise via the use of C<ONLY()>). If this |
50
|
|
|
|
|
|
|
module is used in a code block, C<effects_ok()> defaults to only running |
51
|
|
|
|
|
|
|
specified tests for the remainder of that block's lexical scope. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Note, however, that an explicit C<< ONLY => $boolean >> option in |
54
|
|
|
|
|
|
|
any call to C<<effects_ok()> overrides this lexical default. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 INTERFACE |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 C<use Test::Effects::ONLY;> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
C<effects_ok> defaults to only runnign specified test within the rest of |
61
|
|
|
|
|
|
|
the current lexical scope. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 C<no Test::Effects::ONLY;> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
C<effects_ok> defaults to running all tests (including unspecified ones) |
67
|
|
|
|
|
|
|
within the rest of the current lexical scope. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
None. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Test::Effects::ONLY requires no configuration files or environment variables. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Requires Perl 5.14 (or better). |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Does not require, but is meaningless without, the Test::Effects module. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
None reported. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
No bugs have been reported. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
97
|
|
|
|
|
|
|
C<bug-lib-test-effects@rt.cpan.org>, or through the web interface at |
98
|
|
|
|
|
|
|
L<http://rt.cpan.org>. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Damian Conway C<< <DCONWAY@cpan.org> >> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Copyright (c) 2012, Damian Conway C<< <DCONWAY@cpan.org> >>. All rights reserved. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
111
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L<perlartistic>. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
117
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
118
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
119
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
120
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
121
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
122
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
123
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
124
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
127
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
128
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE |
129
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
130
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
131
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
132
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
133
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
134
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
135
|
|
|
|
|
|
|
SUCH DAMAGES. |