Apocalypse/FileChecks.pm

filter: Statementstmt 100% 35 / 35 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 93.6% 44 / 47 CC 5 SCAR 10.4
CC
5
Cov
95%
do_test
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Apocalypse/DOSnewline.pm ↑ Summary Apocalypse/Script.pm »
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 38 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10 package Test::Apocalypse::FileChecks;
11 38 $Test::Apocalypse::FileChecks::VERSION = '1.006';
12 38 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
13 38 $Test::Apocalypse::FileChecks::AUTHORITY = 'cpan:APOCAL';
14 }
15  
16 # ABSTRACT: Plugin to test for file sanity
17  
18 38 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 38 ▶use File::Find::Rule 0.32;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 38 ▶use Test::File 1.29;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 37 ▶sub do_test {
Subroutine do_test: called CC=5 SCAR=16.1
Pod undocumented
23 37 my @files = qw( Changes Build.PL Makefile.PL LICENSE MANIFEST MANIFEST.SKIP README META.yml );
24 37 my @pmfiles = File::Find::Rule->file()->name( qr/\.pm$/ )->in( 'lib' );
25  
26 # check SIGNATURE if it's there
27 37 ▶ if ( -e 'SIGNATURE' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "SIGNATURE") 37 0 37
28 37 push( @files, 'SIGNATURE' );
29 }
30  
31 # check META.json if it's there
32 37 ▶ if ( -e 'META.json' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "META.json") 37 0 37
33 37 push( @files, 'META.json' );
34 }
35  
36 37 plan tests => ( ( scalar @files ) * 4 ) + ( ( scalar @pmfiles ) * 3 );
37  
38 # ensure our basic CPAN dist contains everything we need
39 37 foreach my $f ( @files ) {
40 370 file_exists_ok( $f, "file $f exists" );
41 370 file_not_empty_ok( $f, "file $f got data" );
42 370 file_readable_ok( $f, "file $f is readable" );
43 370 file_not_executable_ok( $f, "file $f is not executable" );
44 }
45  
46 # check all *.pm files for executable too
47 37 foreach my $f ( @pmfiles ) {
48 1332 file_not_empty_ok( $f, "file $f got data" );
49 1332 file_readable_ok( $f, "file $f is readable" );
50 1332 file_not_executable_ok( $f, "file $f is not executable" );
51 }
52  
53 37 return;
54 }
55  
56 38 1;
57  
58 __END__
« Apocalypse/DOSnewline.pm ↑ Summary Apocalypse/Script.pm »