| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::CPAN::README; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
67288
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
44
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Test::Builder; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
23
|
|
|
7
|
1
|
|
|
1
|
|
8002
|
use Module::Want qw(have_mod ns2distname distname2ns); |
|
|
1
|
|
|
|
|
1579
|
|
|
|
1
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
|
|
$Test::CPAN::README::VERSION = '0.2'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $Test = Test::Builder->new; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
|
13
|
1
|
|
|
1
|
|
8
|
my $self = shift; |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
2
|
my $caller = caller; |
|
16
|
1
|
|
|
1
|
|
109
|
no strict 'refs'; ## no critic |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
369
|
|
|
17
|
1
|
|
|
|
|
2
|
*{ $caller . '::readme_ok' } = \&readme_ok; |
|
|
1
|
|
|
|
|
5
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
7
|
$Test->exported_to($caller); |
|
20
|
1
|
|
|
|
|
10
|
$Test->plan(@_); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub readme_ok { |
|
24
|
0
|
|
|
0
|
1
|
|
my ($ns) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if ( !$ns ) { |
|
27
|
0
|
0
|
|
|
|
|
if ( -e "META.json" ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
require JSON::Syck; |
|
29
|
0
|
|
|
|
|
|
$ns = JSON::Syck::LoadFile("META.json")->{'name'}; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
elsif ( -e "META.yml" ) { |
|
32
|
0
|
|
|
|
|
|
require YAML::Syck; |
|
33
|
0
|
|
|
|
|
|
$ns = YAML::Syck::LoadFile("META.yml")->{'name'}; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
elsif ( -e "META.yaml" ) { |
|
36
|
0
|
|
|
|
|
|
require YAML::Syck; |
|
37
|
0
|
|
|
|
|
|
$ns = YAML::Syck::LoadFile("META.yaml")->{'name'}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
else { |
|
40
|
0
|
|
|
|
|
|
$Test->ok( 0, 'readme_ok() could not find META' ); |
|
41
|
0
|
|
|
|
|
|
return; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$ns = distname2ns($ns); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ( !have_mod($ns) ) { |
|
48
|
0
|
|
|
|
|
|
$Test->ok( 0, 'readme_ok() could not load NS' ); |
|
49
|
0
|
|
|
|
|
|
return; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $pkg = ns2distname($ns); |
|
53
|
0
|
|
|
|
|
|
my $cur = $ns->VERSION; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$Test->plan( tests => 1 ); |
|
56
|
0
|
0
|
0
|
|
|
|
if ( !-f 'README' && -s _ ) { |
|
57
|
0
|
|
|
|
|
|
$Test->ok( 0, 'no README file' ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
else { |
|
60
|
0
|
0
|
|
|
|
|
open my $fh, '<', 'README' or die "Could not read README: $!"; |
|
61
|
0
|
|
|
|
|
|
my ($first_line) = <$fh>; |
|
62
|
0
|
|
|
|
|
|
close $fh; |
|
63
|
0
|
|
|
|
|
|
$Test->is_eq( $first_line, "$pkg version $cur\n", 'First line is " version \n"' ); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |