line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::AuthorTests; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
724
|
use 5.005; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
659
|
use Module::Install::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Module::Install::AuthorTests - designate tests only run by module authors |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
0.002 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
5
|
use vars qw{$VERSION $ISCORE @ISA}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
91
|
|
19
|
|
|
|
|
|
|
BEGIN { |
20
|
1
|
|
|
1
|
|
2
|
$VERSION = '0.002'; |
21
|
1
|
|
|
|
|
2
|
$ISCORE = 1; |
22
|
1
|
|
|
|
|
627
|
@ISA = qw{Module::Install::Base}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 COMMANDS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This plugin adds the following Module::Install commands: |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 author_tests |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
author_tests('xt'); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This declares that the test files found in the directory F<./xt> should be run |
34
|
|
|
|
|
|
|
only if the module is being built by an author. For an explanation, see below. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
You may declare multiple test directories by passing a list of tests. Since |
37
|
|
|
|
|
|
|
tests are not recursive by default, it should be safe to use a subdirectory of |
38
|
|
|
|
|
|
|
F<./t> for author tests, like: |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
author_tests('t/author'); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub author_tests { |
45
|
0
|
|
|
0
|
1
|
|
my ($self, @dirs) = @_; |
46
|
0
|
|
|
|
|
|
_add_author_tests($self, \@dirs, 0); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 recursive_author_tests |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
recursive_author_tests('xt'); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This acts like C<author_tests>, but will look for tests in directories below |
54
|
|
|
|
|
|
|
F<./xt> as well as in the directory itself. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub recursive_author_tests { |
59
|
0
|
|
|
0
|
1
|
|
my ($self, @dirs) = @_; |
60
|
0
|
|
|
|
|
|
_add_author_tests($self, \@dirs, 1); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _wanted { |
64
|
0
|
|
|
0
|
|
|
my $href = shift; |
65
|
0
|
0
|
0
|
0
|
|
|
sub { /\.t$/ and -f $_ and $href->{$File::Find::dir} = 1 } |
66
|
0
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _add_author_tests { |
69
|
0
|
|
|
0
|
|
|
my ($self, $dirs, $recurse) = @_; |
70
|
0
|
0
|
|
|
|
|
return unless $Module::Install::AUTHOR; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
my @tests = $self->tests ? (split / /, $self->tests) : 't/*.t'; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# XXX: pick a default, later -- rjbs, 2008-02-24 |
75
|
0
|
0
|
|
|
|
|
my @dirs = @$dirs ? @$dirs : Carp::confess "no dirs given to author_tests"; |
76
|
0
|
|
|
|
|
|
@dirs = grep { -d } @dirs; |
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
if ($recurse) { |
79
|
0
|
|
|
|
|
|
require File::Find; |
80
|
0
|
|
|
|
|
|
my %test_dir; |
81
|
0
|
|
|
|
|
|
File::Find::find(_wanted(\%test_dir), @dirs); |
82
|
0
|
|
|
|
|
|
$self->tests( join ' ', @tests, map { "$_/*.t" } sort keys %test_dir ); |
|
0
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} else { |
84
|
0
|
|
|
|
|
|
$self->tests( join ' ', @tests, map { "$_/*.t" } sort @dirs ); |
|
0
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 HOW IT WORKS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
"Is this being run by an author?" is determined internally by Module::Install, |
91
|
|
|
|
|
|
|
but at the time of the writing of this version it's determined by the existence |
92
|
|
|
|
|
|
|
of a directory called F<.author> in F<./inc>. (On VMS, it's F<_author>.) This |
93
|
|
|
|
|
|
|
directory is created when Module::Install's F<Makefile.PL> is run in a |
94
|
|
|
|
|
|
|
directory where no F<./inc> directory exists. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 BUGS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Please report any bugs or feature requests through the web interface at |
99
|
|
|
|
|
|
|
L<http://rt.cpan.org>. I will be notified, and then you'll automatically be |
100
|
|
|
|
|
|
|
notified of progress on your bug as I make changes. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Copyright 2008, Ricardo SIGNES. This program is free software; you can |
105
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as Perl itself. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |