Commit | Line | Data |
---|---|---|
b4514920 CG |
1 | package Test2::API::Breakage; |
2 | use strict; | |
3 | use warnings; | |
4 | ||
18c72c39 | 5 | our $VERSION = '1.302181'; |
b4514920 CG |
6 | |
7 | ||
8 | use Test2::Util qw/pkg_to_file/; | |
9 | ||
10 | our @EXPORT_OK = qw{ | |
11 | upgrade_suggested | |
12 | upgrade_required | |
13 | known_broken | |
14 | }; | |
58818a66 | 15 | BEGIN { require Exporter; our @ISA = qw(Exporter) } |
b4514920 CG |
16 | |
17 | sub upgrade_suggested { | |
18 | return ( | |
19 | 'Test::Exception' => '0.42', | |
20 | 'Test::FITesque' => '0.04', | |
21 | 'Test::Module::Used' => '0.2.5', | |
22 | 'Test::Moose::More' => '0.025', | |
23 | ); | |
24 | } | |
25 | ||
26 | sub upgrade_required { | |
27 | return ( | |
28 | 'Test::Builder::Clutch' => '0.07', | |
29 | 'Test::Dist::VersionSync' => '1.1.4', | |
30 | 'Test::Modern' => '0.012', | |
31 | 'Test::SharedFork' => '0.34', | |
32 | 'Test::Alien' => '0.04', | |
35014935 | 33 | 'Test::UseAllModules' => '0.14', |
07bc328a | 34 | 'Test::More::Prefix' => '0.005', |
b4514920 | 35 | |
07bc328a SH |
36 | 'Test2::Tools::EventDumper' => 0.000007, |
37 | 'Test2::Harness' => 0.000013, | |
38 | ||
39 | 'Test::DBIx::Class::Schema' => '1.0.9', | |
b4514920 CG |
40 | 'Test::Clustericious::Cluster' => '0.30', |
41 | ); | |
42 | } | |
43 | ||
44 | sub known_broken { | |
45 | return ( | |
46 | 'Net::BitTorrent' => '0.052', | |
47 | 'Test::Able' => '0.11', | |
48 | 'Test::Aggregate' => '0.373', | |
49 | 'Test::Flatten' => '0.11', | |
50 | 'Test::Group' => '0.20', | |
b4514920 CG |
51 | 'Test::ParallelSubtest' => '0.05', |
52 | 'Test::Pretty' => '0.32', | |
53 | 'Test::Wrapper' => '0.3.0', | |
54 | ||
b4514920 CG |
55 | 'Log::Dispatch::Config::TestLog' => '0.02', |
56 | ); | |
57 | } | |
58 | ||
59 | # Not reportable: | |
60 | # Device::Chip => 0.07 - Tests will not pass, but not broken if already installed, also no fixed version we can upgrade to. | |
61 | ||
62 | sub report { | |
63 | my $class = shift; | |
64 | my ($require) = @_; | |
65 | ||
66 | my %suggest = __PACKAGE__->upgrade_suggested(); | |
67 | my %required = __PACKAGE__->upgrade_required(); | |
68 | my %broken = __PACKAGE__->known_broken(); | |
69 | ||
70 | my @warn; | |
71 | for my $mod (keys %suggest) { | |
72 | my $file = pkg_to_file($mod); | |
73 | next unless $INC{$file} || ($require && eval { require $file; 1 }); | |
74 | my $want = $suggest{$mod}; | |
75 | next if eval { $mod->VERSION($want); 1 }; | |
6c61bcd8 CG |
76 | my $error = $@; |
77 | chomp $error; | |
78 | push @warn => " * Module '$mod' is outdated, we recommed updating above $want. error was: '$error'; INC is $INC{$file}"; | |
b4514920 CG |
79 | } |
80 | ||
81 | for my $mod (keys %required) { | |
82 | my $file = pkg_to_file($mod); | |
83 | next unless $INC{$file} || ($require && eval { require $file; 1 }); | |
84 | my $want = $required{$mod}; | |
85 | next if eval { $mod->VERSION($want); 1 }; | |
86 | push @warn => " * Module '$mod' is outdated and known to be broken, please update to $want or higher."; | |
87 | } | |
88 | ||
89 | for my $mod (keys %broken) { | |
90 | my $file = pkg_to_file($mod); | |
91 | next unless $INC{$file} || ($require && eval { require $file; 1 }); | |
92 | my $tested = $broken{$mod}; | |
93 | push @warn => " * Module '$mod' is known to be broken in version $tested and below, newer versions have not been tested. You have: " . $mod->VERSION; | |
94 | } | |
95 | ||
96 | return @warn; | |
97 | } | |
98 | ||
99 | 1; | |
100 | ||
101 | __END__ | |
102 | ||
103 | ||
104 | =pod | |
105 | ||
106 | =encoding UTF-8 | |
107 | ||
108 | =head1 NAME | |
109 | ||
110 | Test2::API::Breakage - What breaks at what version | |
111 | ||
112 | =head1 DESCRIPTION | |
113 | ||
114 | This module provides lists of modules that are broken, or have been broken in | |
115 | the past, when upgrading L<Test::Builder> to use L<Test2>. | |
116 | ||
117 | =head1 FUNCTIONS | |
118 | ||
119 | These can be imported, or called as methods on the class. | |
120 | ||
121 | =over 4 | |
122 | ||
123 | =item %mod_ver = upgrade_suggested() | |
124 | ||
125 | =item %mod_ver = Test2::API::Breakage->upgrade_suggested() | |
126 | ||
127 | This returns key/value pairs. The key is the module name, the value is the | |
128 | version number. If the installed version of the module is at or below the | |
129 | specified one then an upgrade would be a good idea, but not strictly necessary. | |
130 | ||
131 | =item %mod_ver = upgrade_required() | |
132 | ||
133 | =item %mod_ver = Test2::API::Breakage->upgrade_required() | |
134 | ||
135 | This returns key/value pairs. The key is the module name, the value is the | |
136 | version number. If the installed version of the module is at or below the | |
137 | specified one then an upgrade is required for the module to work properly. | |
138 | ||
139 | =item %mod_ver = known_broken() | |
140 | ||
141 | =item %mod_ver = Test2::API::Breakage->known_broken() | |
142 | ||
143 | This returns key/value pairs. The key is the module name, the value is the | |
144 | version number. If the installed version of the module is at or below the | |
145 | specified one then the module will not work. A newer version may work, but is | |
146 | not tested or verified. | |
147 | ||
58818a66 CG |
148 | =back |
149 | ||
b4514920 CG |
150 | =head1 SOURCE |
151 | ||
152 | The source code repository for Test2 can be found at | |
153 | F<http://github.com/Test-More/test-more/>. | |
154 | ||
155 | =head1 MAINTAINERS | |
156 | ||
157 | =over 4 | |
158 | ||
159 | =item Chad Granum E<lt>exodist@cpan.orgE<gt> | |
160 | ||
161 | =back | |
162 | ||
163 | =head1 AUTHORS | |
164 | ||
165 | =over 4 | |
166 | ||
167 | =item Chad Granum E<lt>exodist@cpan.orgE<gt> | |
168 | ||
169 | =back | |
170 | ||
171 | =head1 COPYRIGHT | |
172 | ||
18c72c39 | 173 | Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. |
b4514920 CG |
174 | |
175 | This program is free software; you can redistribute it and/or | |
176 | modify it under the same terms as Perl itself. | |
177 | ||
178 | See F<http://dev.perl.org/licenses/> | |
179 | ||
180 | =cut |