CPAN-cpanminus-reporter-RetainReports
view release on metacpan or search on metacpan
scripts/dump-parsed-cpanm-build-logs view on Meta::CPAN
Copyright (c) 2017 James E Keenan. All rights reserved.
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
=head1 SEE ALSO
perl(1). CPAN::cpanminus::reporter::RetainReports(3). JSON(3).
=cut
my $decoded;
if (@ARGV) {
for my $lfile (@ARGV) {
croak "Cannot locate $lfile" unless (-f $lfile);
my $f = Path::Tiny::path($lfile);
$decoded = decode_json($f->slurp_utf8);
display_text($decoded);
}
}
else {
$decoded = decode_json(<STDIN>);
display_text($decoded);
}
exit 0;
sub display_text {
my $decoded = shift;
my $reworked = { map { $_ => $decoded->{$_} } sort grep { $_ ne 'test_output' } keys %{$decoded} };
$reworked->{test_output} = [ split(/\n/, $decoded->{test_output}) ];
dd($reworked);
return 1;
}
t/lib/Testing.pm view on Meta::CPAN
);
Test::More::ok(defined $reporter, 'created new reporter object');
return $reporter;
}
sub _analyze_json_file {
my ($tdir, $hr) = @_;
my $lfile = File::Spec->catfile($tdir, "$hr->{json_title}.log.json");
Test::More::ok(-f $lfile, "Log file $lfile created");
my $f = Path::Tiny::path($lfile);
my $decoded = decode_json($f->slurp_utf8);
_test_json_output($decoded, $hr->{expected});
return 1;
}
sub _test_json_output {
my ($got, $expected) = @_;
my $pattern = "%-28s%s";
Test::More::is($got->{author}, $expected->{author},
sprintf($pattern => ('Got expected author:', $expected->{author})));
Test::More::is($got->{distname}, $expected->{distname},
sprintf($pattern => ('Got expected distname:', $expected->{distname})));
( run in 0.352 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )