line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Test::Cookbook ; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
37795
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN |
8
|
|
|
|
|
|
|
{ |
9
|
1
|
|
|
1
|
|
5
|
use vars qw ($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
96
|
|
10
|
1
|
|
|
1
|
|
34
|
$VERSION = '0.05' ; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1084
|
use English qw( -no_match_vars ) ; |
|
1
|
|
|
|
|
5226
|
|
|
1
|
|
|
|
|
7
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
539
|
use Carp qw(carp croak confess) ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
84
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
1127
|
use Filter::Simple ; |
|
1
|
|
|
|
|
55167
|
|
|
1
|
|
|
|
|
13
|
|
25
|
1
|
|
|
1
|
|
822
|
use POD::Tested ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use IO::String ; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my @setup ; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Test::Cookbook - Write your tests as cookbooks |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
With your test formatted as a cookbook in B<t/005_cookbook.t> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$> ./Build test |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$> ./Build test --test_files t/005_cookbook.t |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$> prove t/005_cookbook.t |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$> runtests t/005_cookbook.t |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$> pod_tested.pl -i t/005_cookbook.t -o cookbook.pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This module is wrapper around L<POD::Tested>. L<POD::Tested> let's you write POD containing tests. |
54
|
|
|
|
|
|
|
I use it mainly to write cookbooks with the ability to check the cookbook and generate part of it. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
I started by writing tests, then I copied the tests into the cookbook. Then it hit me that both could be the same. |
57
|
|
|
|
|
|
|
That I could write my tests as cookbooks. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
These are the advantages when writing your tests as cookbooks: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=over 2 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item * single file to manipulate, no copy/paste and the errors associated with it |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item * your tests become much easier to read because they must be documented |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * you can manually generate cookbooks from your tests |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * you can generate cookbooks when your tests are run (not yet implemented) |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * design and document your modules in the tests |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DOCUMENTATION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub import |
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 import |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is automatically called for you by Perl |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
return(1) ; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
FILTER |
102
|
|
|
|
|
|
|
{ |
103
|
|
|
|
|
|
|
=head2 FILTER |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is automatically called for you by Perl |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my $parser = POD::Tested->new(INPUT => $PROGRAM_NAME, @setup, STRING => $_) ; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
return(1) ; |
112
|
|
|
|
|
|
|
} ; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1 ; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
None so far. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Khemir Nadim ibn Hamouda |
125
|
|
|
|
|
|
|
CPAN ID: NKH |
126
|
|
|
|
|
|
|
mailto:nadim@khemir.net |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This program is free software; you can redistribute |
131
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 SUPPORT |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
perldoc Test::Cookbook |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
You can also look for information at: |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over 4 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
L<http://annocpan.org/dist/Test-Cookbook> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Please report any bugs or feature requests to L <bug-test-cookbook@rt.cpan.org>. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
We will be notified, and then you'll automatically be notified of progress on |
152
|
|
|
|
|
|
|
your bug as we make changes. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * Search CPAN |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/Test-Cookbook> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=back |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 SEE ALSO |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L<POD::Tested> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|