File Coverage

blib/lib/ExtUtils/ModuleMaker/PBP/Auxiliary.pm
Criterion Covered Total %
statement 19 19 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             package ExtUtils::ModuleMaker::PBP::Auxiliary;
2             # Contains test subroutines for distribution with ExtUtils::ModuleMaker::PBP
3             # As of: April 5, 2006
4 5     5   8993 use strict;
  5         14  
  5         255  
5             local $^W = 1;
6 5     5   29 use vars qw( $VERSION @ISA @EXPORT_OK );
  5         9  
  5         496  
7             $VERSION = '0.09';
8             require Exporter;
9             @ISA = qw(Exporter);
10             @EXPORT_OK = qw(
11             check_MakefilePL
12             );
13 5     5   30 use File::Spec;
  5         8  
  5         579  
14             *ok = *Test::More::ok;
15             *is = *Test::More::is;
16             *like = *Test::More::like;
17             *copy = *File::Copy::copy;
18             *move = *File::Copy::move;
19 5         1379 use ExtUtils::ModuleMaker::Auxiliary qw(
20             read_file_string
21 5     5   5051 );
  5         39862  
22              
23             =head1 NAME
24              
25             ExtUtils::ModuleMaker::PBP::Auxiliary - Subroutines for testing ExtUtils::ModuleMaker::PBP
26              
27             =head1 DESCRIPTION
28              
29             This package contains subroutines used in one or more F files in
30             ExtUtils::ModuleMaker::PBP's test suite.
31              
32             =head1 SUBROUTINES
33              
34             =head2 C
35              
36             Function: Verify that content of Makefile.PL was created correctly.
37             Argument: Two arguments:
38             1. A string holding the directory in which the Makefile.PL
39             should have been created.
40             2. A reference to an array holding strings each of which is a
41             prediction as to content of particular lines in Makefile.PL.
42             Returns: n/a.
43             Used: To see whether Makefile.PL created by complete_build() has
44             correct entries. Runs 1 Test::More test which checks NAME,
45             VERSION_FROM, AUTHOR and ABSTRACT.
46              
47             =cut
48              
49             sub check_MakefilePL {
50 5     5 1 12191809 my ($topdir, $predictref) = @_;
51 5         66 my @pred = @$predictref;
52              
53 5         150 my $mkfl = File::Spec->catfile( $topdir, q{Makefile.PL} );
54 5         56 local *MAK;
55 5 50       745 open MAK, $mkfl or die "Unable to open Makefile.PL: $!";
56 5         121 my $bigstr = read_file_string($mkfl);
57 5         1050 like($bigstr, qr/
58             NAME.+($pred[0]).+
59             AUTHOR.+($pred[1]).+
60             ($pred[2]).+
61             VERSION_FROM.+($pred[3]).+
62             ABSTRACT_FROM.+($pred[4])
63             /sx, "Makefile.PL has predicted values");
64             }
65              
66             1;
67