line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of Test-Apocalypse |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is copyright (c) 2014 by Apocalypse. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
7
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
8
|
|
|
|
|
|
|
# |
9
|
39
|
|
|
39
|
|
6091844
|
use strict; use warnings; |
|
39
|
|
|
39
|
|
93
|
|
|
39
|
|
|
|
|
1389
|
|
|
39
|
|
|
|
|
165
|
|
|
39
|
|
|
|
|
84
|
|
|
39
|
|
|
|
|
1868
|
|
10
|
|
|
|
|
|
|
package Test::Apocalypse::FileChecks; |
11
|
|
|
|
|
|
|
$Test::Apocalypse::FileChecks::VERSION = '1.003'; |
12
|
|
|
|
|
|
|
BEGIN { |
13
|
39
|
|
|
39
|
|
522
|
$Test::Apocalypse::FileChecks::AUTHORITY = 'cpan:APOCAL'; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ABSTRACT: Plugin to test for file sanity |
17
|
|
|
|
|
|
|
|
18
|
39
|
|
|
39
|
|
164
|
use Test::More; |
|
39
|
|
|
|
|
187
|
|
|
39
|
|
|
|
|
311
|
|
19
|
39
|
|
|
39
|
|
10960
|
use File::Find::Rule 0.32; |
|
39
|
|
|
|
|
10951
|
|
|
39
|
|
|
|
|
318
|
|
20
|
39
|
|
|
39
|
|
22073
|
use Test::File 1.29; |
|
39
|
|
|
|
|
197429
|
|
|
39
|
|
|
|
|
14027
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub do_test { |
23
|
38
|
|
|
38
|
0
|
190
|
my @files = qw( Changes Build.PL Makefile.PL LICENSE MANIFEST MANIFEST.SKIP README META.yml ); |
24
|
38
|
|
|
|
|
2090
|
my @pmfiles = File::Find::Rule->file()->name( qr/\.pm$/ )->in( 'lib' ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# check SIGNATURE if it's there |
27
|
38
|
50
|
|
|
|
61066
|
if ( -e 'SIGNATURE' ) { |
28
|
38
|
|
|
|
|
114
|
push( @files, 'SIGNATURE' ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# check META.json if it's there |
32
|
38
|
50
|
|
|
|
342
|
if ( -e 'META.json' ) { |
33
|
38
|
|
|
|
|
76
|
push( @files, 'META.json' ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
38
|
|
|
|
|
228
|
plan tests => ( ( scalar @files ) * 4 ) + ( ( scalar @pmfiles ) * 3 ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# ensure our basic CPAN dist contains everything we need |
39
|
38
|
|
|
|
|
6954
|
foreach my $f ( @files ) { |
40
|
380
|
|
|
|
|
108680
|
file_exists_ok( $f, "file $f exists" ); |
41
|
380
|
|
|
|
|
121942
|
file_not_empty_ok( $f, "file $f got data" ); |
42
|
380
|
|
|
|
|
118712
|
file_readable_ok( $f, "file $f is readable" ); |
43
|
380
|
|
|
|
|
116774
|
file_not_executable_ok( $f, "file $f is not executable" ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# check all *.pm files for executable too |
47
|
38
|
|
|
|
|
11742
|
foreach my $f ( @pmfiles ) { |
48
|
1406
|
|
|
|
|
452466
|
file_not_empty_ok( $f, "file $f got data" ); |
49
|
1406
|
|
|
|
|
456380
|
file_readable_ok( $f, "file $f is readable" ); |
50
|
1406
|
|
|
|
|
451592
|
file_not_executable_ok( $f, "file $f is not executable" ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
38
|
|
|
|
|
12616
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding UTF-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=for :stopwords Apocalypse Niebur Ryan dist |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=for Pod::Coverage do_test |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Test::Apocalypse::FileChecks - Plugin to test for file sanity |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This document describes v1.003 of Test::Apocalypse::FileChecks - released October 24, 2014 as part of Test-Apocalypse. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 DESCRIPTION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This plugin ensures basic sanity for the files in the dist. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over 4 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L<Test::Apocalypse|Test::Apocalypse> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Apocalypse <APOCAL@cpan.org> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Apocalypse. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The full text of the license can be found in the |
104
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
109
|
|
|
|
|
|
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
110
|
|
|
|
|
|
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
111
|
|
|
|
|
|
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
112
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
113
|
|
|
|
|
|
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
114
|
|
|
|
|
|
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
115
|
|
|
|
|
|
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
118
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
119
|
|
|
|
|
|
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
120
|
|
|
|
|
|
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
121
|
|
|
|
|
|
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
122
|
|
|
|
|
|
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
123
|
|
|
|
|
|
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
124
|
|
|
|
|
|
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
125
|
|
|
|
|
|
|
SUCH DAMAGES. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |