D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
usr
/
share
/
doc
/
perl-Test-Simple
/
t
/
Filename :
zzz-check-breaks.t
back
Copy
use strict; use warnings; # Must not fail! END { $? = 0 } # this test is very similar to what is generated by Dist::Zilla::Plugin::Test::CheckBreaks use Test::More; eval { require CPAN::Meta; require CPAN::Meta::Requirements; CPAN::Meta::Requirements->VERSION(2.120920); require Module::Metadata; 1 } or plan skip_all => 'breakage test requires CPAN::Meta, CPAN::Meta::Requirements and Module::Metadata'; my $metafile = -e 'MYMETA.json' ? 'MYMETA.json' : -e 'META.json' ? 'META.json' : undef; unless ($metafile) { plan skip_all => "can't check breakages without some META file"; } eval { my $breaks = CPAN::Meta->load_file($metafile)->custom('x_breaks'); my $reqs = CPAN::Meta::Requirements->new; $reqs->add_string_requirement($_, $breaks->{$_}) foreach keys %$breaks; my $result = check_breaks($reqs); if (my @breaks = grep { defined $result->{$_} } keys %$result) { diag 'You have the following modules installed, which are not compatible with the latest Test::More:'; diag "$result->{$_}" for sort @breaks; diag "\n", 'You should now update these modules!'; diag "You should also see Test2::Transition!"; } pass 'conflicting modules checked'; 1; } or plan skip_all => "Could not check conflicting modules: $@"; # this is an inlined simplification of CPAN::Meta::Check. sub check_breaks { my $reqs = shift; return +{ map { $_ => _check_break($reqs, $_) } $reqs->required_modules, }; } sub _check_break { my ($reqs, $module) = @_; my $metadata = Module::Metadata->new_from_module($module); return undef if not defined $metadata; my $version = eval { $metadata->version }; return "Missing version info for module '$module'" if not $version; return sprintf 'Installed version (%s) of %s is in range \'%s\'', $version, $module, $reqs->requirements_for_module($module) if $reqs->accepts_module($module, $version); return undef; } done_testing;
Name
Size
Last Modified
Owner
Permissions
Actions
Legacy
Dir
July 28 2023 2:57:48
root
0755
Legacy_And_Test2
Dir
July 28 2023 2:57:48
root
0755
Test2
Dir
July 28 2023 2:57:48
root
0755
lib
Dir
July 28 2023 2:57:48
root
0755
regression
Dir
July 28 2023 2:57:48
root
0755
00-report.t
1.447
KB
March 30 2018 5:53:02
root
0644
00compile.t
1.092
KB
March 30 2018 5:53:02
root
0644
HashBase.t
5.471
KB
March 30 2018 5:53:02
root
0644
zzz-check-breaks.t
1.989
KB
March 30 2018 5:53:02
root
0644
2017 © D7net | D704T team