File Coverage

blib/lib/Test/CPAN/Changes/ReallyStrict.pm
Criterion Covered Total %
statement 42 44 95.4
branch n/a
condition 1 2 50.0
subroutine 11 12 91.6
pod 2 2 100.0
total 56 60 93.3


line stmt bran cond sub pod time code
1 6     6   263619 use 5.006;
  6         20  
2 6     6   31 use strict;
  6         15  
  6         188  
3 6     6   31 use warnings;
  6         10  
  6         581  
4              
5             package Test::CPAN::Changes::ReallyStrict;
6              
7             our $VERSION = '1.000004';
8              
9             #ABSTRACT: Ensure a Changes file looks exactly like it would if it was machine generated.
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13 6     6   983 use CPAN::Changes 0.17;
  6         41161  
  6         213  
14 6     6   580 use Test::Builder;
  6         7725  
  6         176  
15 6     6   4351 use Test::CPAN::Changes::ReallyStrict::Object;
  6         19  
  6         505  
16              
17             my $TEST = Test::Builder->new();
18              
19             sub import {
20 4     4   51 my ( undef, @args ) = @_;
21              
22 4         11 my $caller = caller;
23             {
24             ## no critic (ProhibitNoStrict);
25 6     6   46 no strict 'refs';
  6         9  
  6         2088  
  4         7  
26 4         9 *{ $caller . '::changes_ok' } = \&changes_ok;
  4         35  
27 4         8 *{ $caller . '::changes_file_ok' } = \&changes_file_ok;
  4         22  
28             }
29 4         48 $TEST->exported_to($caller);
30 4         53 $TEST->plan(@args);
31 4         5971 return 1;
32             }
33              
34              
35              
36              
37              
38              
39              
40              
41              
42              
43              
44              
45              
46             sub changes_ok {
47 1     1 1 11 my (@args) = @_;
48 1         3 return changes_file_ok( undef, @args );
49             }
50              
51             # For testing.
52             sub _real_changes_ok {
53 0     0   0 my ( $tester, $state ) = @_;
54 0         0 return _real_changes_file_ok( $tester, $state );
55             }
56              
57              
58              
59              
60              
61              
62              
63              
64              
65              
66              
67              
68              
69              
70              
71             sub changes_file_ok {
72 1     1 1 2 my ( $file, $config ) = @_;
73 1   50     9 $file ||= 'Changes';
74 1         2 $config->{filename} = $file;
75             my $changes_obj = Test::CPAN::Changes::ReallyStrict::Object->new(
76             {
77             testbuilder => $TEST,
78 1         1 %{$config},
  1         15  
79             },
80             );
81 1         143 return $changes_obj->changes_ok;
82             }
83              
84             # Factoring design split so testing can inject a test::builder dummy
85              
86             sub _real_changes_file_ok {
87 4     4   594 my ( $tester, $state ) = @_;
88             my $changes_obj = Test::CPAN::Changes::ReallyStrict::Object->new(
89             {
90             testbuilder => $tester,
91 4         10 %{$state},
  4         67  
92             },
93             );
94 4         444 return $changes_obj->changes_ok;
95             }
96              
97             1;
98              
99             __END__