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