line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# $Id: Folder.pm,v 1.7 2011-02-20 01:57:51 Martin Exp $ |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::Folder; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
22088
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
50
|
|
7
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
136
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our |
10
|
|
|
|
|
|
|
$VERSION = do { my @r = (q$Revision: 1.7 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
11
|
use base qw( Exporter Test::Dir::Base ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
904
|
|
13
|
|
|
|
|
|
|
our @EXPORT; |
14
|
|
|
|
|
|
|
push @EXPORT, qw( folder_exists_ok folder_not_exists_ok ); |
15
|
|
|
|
|
|
|
push @EXPORT, qw( folder_empty_ok folder_not_empty_ok ); |
16
|
|
|
|
|
|
|
push @EXPORT, qw( folder_readable_ok folder_not_readable_ok ); |
17
|
|
|
|
|
|
|
push @EXPORT, qw( folder_writable_ok folder_not_writable_ok ); |
18
|
|
|
|
|
|
|
push @EXPORT, qw( folder_executable_ok folder_not_executable_ok ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$Test::Dir::Base::dir = q{folder}; |
21
|
|
|
|
|
|
|
$Test::Dir::Base::directory = q{folder}; |
22
|
|
|
|
|
|
|
$Test::Dir::Base::Dir = q{Folder}; |
23
|
|
|
|
|
|
|
$Test::Dir::Base::Directory = q{Folder}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Test::Folder - test folder attributes |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Test::More ...; |
32
|
|
|
|
|
|
|
use Test::Folder; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This modules provides a collection of test utilities for folder attributes. |
37
|
|
|
|
|
|
|
Use it in combination with Test::More in your test programs. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 FUNCTIONS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 folder_exists_ok(FOLDERNAME [, TESTNAME] ) |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Ok if the folder exists, and not ok otherwise. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub folder_exists_ok |
48
|
|
|
|
|
|
|
{ |
49
|
1
|
|
|
1
|
1
|
265
|
Test::Dir::Base::_dir_exists_ok(@_); |
50
|
|
|
|
|
|
|
} # folder_exists_ok |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 folder_not_exists_ok(FOLDERNAME [, TESTNAME] ) |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Ok if the folder does not exist, and not ok otherwise. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub folder_not_exists_ok |
60
|
|
|
|
|
|
|
{ |
61
|
1
|
|
|
1
|
1
|
962
|
Test::Dir::Base::_dir_not_exists_ok(@_); |
62
|
|
|
|
|
|
|
} # folder_not_exists_ok |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 folder_empty_ok(FOLDERNAME [, TESTNAME] ) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Ok if the folder is empty |
68
|
|
|
|
|
|
|
(contains no files or subfolders), |
69
|
|
|
|
|
|
|
and not ok otherwise. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub folder_empty_ok |
74
|
|
|
|
|
|
|
{ |
75
|
1
|
|
|
1
|
1
|
1176
|
Test::Dir::Base::_dir_empty_ok(@_); |
76
|
|
|
|
|
|
|
} # folder_empty_ok |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 folder_not_empty_ok(FOLDERNAME [, TESTNAME] ) |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Ok if the folder is not empty |
81
|
|
|
|
|
|
|
(contains any files or subfolders), |
82
|
|
|
|
|
|
|
and not ok otherwise. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub folder_not_empty_ok |
87
|
|
|
|
|
|
|
{ |
88
|
1
|
|
|
1
|
1
|
869
|
Test::Dir::Base::_dir_not_empty_ok(@_); |
89
|
|
|
|
|
|
|
} # folder_not_empty_ok |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 folder_readable_ok(FOLDERNAME [, TESTNAME] ) |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Ok if the folder is readable, and not ok otherwise. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub folder_readable_ok |
99
|
|
|
|
|
|
|
{ |
100
|
1
|
|
|
1
|
1
|
901
|
Test::Dir::Base::_dir_readable_ok(@_); |
101
|
|
|
|
|
|
|
} # folder_readable_ok |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 folder_not_readable_ok(FOLDERNAME [, TESTNAME] ) |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Ok if the folder is not readable, and not ok otherwise. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub folder_not_readable_ok |
110
|
|
|
|
|
|
|
{ |
111
|
0
|
|
|
0
|
1
|
0
|
Test::Dir::Base::_dir_not_readable_ok(@_); |
112
|
|
|
|
|
|
|
} # folder_not_readable_ok |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 folder_writable_ok(FOLDERNAME [, TESTNAME] ) |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Ok if the folder is writable, and not ok otherwise. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub folder_writable_ok |
122
|
|
|
|
|
|
|
{ |
123
|
1
|
|
|
1
|
1
|
780
|
Test::Dir::Base::_dir_writable_ok(@_); |
124
|
|
|
|
|
|
|
} # folder_writable_ok |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 folder_not_writable_ok(FOLDERNAME [, TESTNAME] ) |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Ok if the folder is not writable, and not ok otherwise. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub folder_not_writable_ok |
133
|
|
|
|
|
|
|
{ |
134
|
0
|
|
|
0
|
1
|
0
|
Test::Dir::Base::_dir_not_writable_ok(@_); |
135
|
|
|
|
|
|
|
} # folder_not_writable_ok |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 folder_executable_ok(FOLDERNAME [, TESTNAME] ) |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Ok if the folder is executable, and not ok otherwise. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub folder_executable_ok |
145
|
|
|
|
|
|
|
{ |
146
|
1
|
|
|
1
|
1
|
791
|
Test::Dir::Base::_dir_executable_ok(@_); |
147
|
|
|
|
|
|
|
} # folder_executable_ok |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 folder_not_executable_ok(FOLDERNAME [, TESTNAME] ) |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Ok if the folder is not executable, and not ok otherwise. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub folder_not_executable_ok |
156
|
|
|
|
|
|
|
{ |
157
|
0
|
|
|
0
|
1
|
|
Test::Dir::Base::_dir_not_executable_ok(@_); |
158
|
|
|
|
|
|
|
} # folder_not_executable_ok |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 TO DO |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
There are probably some more folder attributes that can be tested. |
164
|
|
|
|
|
|
|
If you need them, please ask (or better yet, contribute code!). |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 AUTHOR |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Martin 'Kingpin' Thurn, C, L. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 BUGS |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
173
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
174
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 SUPPORT |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
perldoc Test::Folder |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
You can also look for information at: |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=over 4 |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
L |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
L |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item * CPAN Ratings |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
L |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * Search CPAN |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
L |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=back |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Copyright (C) 2007-2008 Martin 'Kingpin' Thurn |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
213
|
|
|
|
|
|
|
under the same terms as Perl itself. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=cut |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
1; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
__END__ |