File Coverage

blib/lib/Test2/API/Breakage.pm
Criterion Covered Total %
statement 46 49 93.8
branch 7 10 70.0
condition 12 18 66.6
subroutine 8 8 100.0
pod 1 1 100.0
total 74 86 86.0


line stmt bran cond sub pod time code
1             package Test2::API::Breakage;
2 4     4   1544 use strict;
  4         7  
  4         118  
3 4     4   14 use warnings;
  4         4  
  4         182  
4              
5             our $VERSION = '0.000044';
6              
7 4     4   12 use Test2::Util qw/pkg_to_file/;
  4         4  
  4         265  
8              
9             our @EXPORT_OK = qw{
10             upgrade_suggested
11             upgrade_required
12             known_broken
13             };
14 4     4   15 use base 'Exporter';
  4         4  
  4         1578  
15              
16             sub upgrade_suggested {
17             return (
18 17     17   86 'Test::Exception' => '0.42',
19             'Test::FITesque' => '0.04',
20             'Test::Module::Used' => '0.2.5',
21             'Test::Moose::More' => '0.025',
22             );
23             }
24              
25             sub upgrade_required {
26             return (
27 17     17   73 'Test::Builder::Clutch' => '0.07',
28             'Test::Dist::VersionSync' => '1.1.4',
29             'Test::Modern' => '0.012',
30             'Test::SharedFork' => '0.34',
31              
32             'Test::Clustericious::Cluster' => '0.31',
33             );
34             }
35              
36             sub known_broken {
37             return (
38 17     17   96 'Net::BitTorrent' => '0.052',
39             'Test::Aggregate' => '0.373',
40             'Test::Flatten' => '0.11',
41             'Test::Group' => '0.20',
42             'Test::More::Prefix' => '0.005',
43             'Test::ParallelSubtest' => '0.05',
44             'Test::Pretty' => '0.32',
45             'Test::Wrapper' => '0.3.0',
46              
47             'Test::DBIx::Class::Schema' => '1.0.9',
48             );
49             }
50              
51             sub report {
52 21     21 1 48 my $class = shift;
53 21         22 my ($require) = @_;
54              
55 21         34 my %suggest = __PACKAGE__->upgrade_suggested();
56 21         57 my %required = __PACKAGE__->upgrade_required();
57 21         44 my %broken = __PACKAGE__->known_broken();
58              
59 21         35 my @warn;
60 21         48 for my $mod (keys %suggest) {
61 74         355 my $file = pkg_to_file($mod);
62 74 50 66     240 next unless $INC{$file} || ($require && eval { require $file; 1 });
  4   66     356  
  0         0  
63 2         4 my $want = $suggest{$mod};
64 2 100       1 next if eval { $mod->VERSION($want); 1 };
  2         35  
  1         8  
65 1         5 push @warn => " * Module '$mod' is outdated, we recommed updating above $want.";
66             }
67              
68 21         169 for my $mod (keys %required) {
69 90         245 my $file = pkg_to_file($mod);
70 90 50 66     261 next unless $INC{$file} || ($require && eval { require $file; 1 });
  4   66     295  
  0         0  
71 2         2 my $want = $required{$mod};
72 2 100       1 next if eval { $mod->VERSION($want); 1 };
  2         18  
  1         3  
73 1         4 push @warn => " * Module '$mod' is outdated and known to be broken, please update to $want or higher.";
74             }
75              
76 21         161 for my $mod (keys %broken) {
77 154         320 my $file = pkg_to_file($mod);
78 154 50 66     378 next unless $INC{$file} || ($require && eval { require $file; 1 });
  4   66     282  
  0         0  
79 2         3 my $tested = $broken{$mod};
80 2         15 push @warn => " * Module '$mod' is known to be broken in version $tested and below, newer versions have not been tested. You have: " . $mod->VERSION;
81             }
82              
83 21         212 return @warn;
84             }
85              
86             1;
87              
88             __END__