File Coverage

blib/lib/Perl/PrereqScanner/Scanner/TestMore.pm
Criterion Covered Total %
statement 20 20 100.0
branch 7 10 70.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 33 37 89.1


line stmt bran cond sub pod time code
1 2     2   12 use strict;
  2         4  
  2         63  
2 2     2   10 use warnings;
  2         3  
  2         79  
3              
4             package Perl::PrereqScanner::Scanner::TestMore 1.024;
5             # ABSTRACT: scanner to find recent Test::More usage
6              
7 2     2   9 use Moose;
  2         4  
  2         12  
8 2     2   11788 use List::Util 1.33 'none';
  2         57  
  2         525  
9             with 'Perl::PrereqScanner::Scanner';
10              
11             sub scan_for_prereqs {
12 265     265 0 773 my ($self, $ppi_doc, $req) = @_;
13              
14 265 100   222   2163 return if none { $_ eq 'Test::More' } $req->required_modules;
  222         1933  
15              
16             $req->add_minimum('Test::More' => '0.88') if grep {
17 3 50       19 $_->isa('PPI::Token::Word') && $_->content eq 'done_testing';
18             } map {
19 9         1365 my @c = $_->children;
20 9 100       55 @c == 1 ? @c : ()
21 3 50       10 } @{ $ppi_doc->find('Statement') || [] }
  3 50       12  
22             }
23              
24             1;
25              
26             =pod
27              
28             =encoding UTF-8
29              
30             =head1 NAME
31              
32             Perl::PrereqScanner::Scanner::TestMore - scanner to find recent Test::More usage
33              
34             =head1 VERSION
35              
36             version 1.024
37              
38             =head1 DESCRIPTION
39              
40             This scanner will check if a given test is using recent functions from
41             L<Test::More>, and increase the minimum version for this module
42             accordingly.
43              
44             =head1 PERL VERSION
45              
46             This library should run on perls released even a long time ago. It should work
47             on any version of perl released in the last five years.
48              
49             Although it may work on older versions of perl, no guarantee is made that the
50             minimum required version will not be increased. The version may be increased
51             for any reason, and there is no promise that patches will be accepted to lower
52             the minimum required perl.
53              
54             =head1 AUTHORS
55              
56             =over 4
57              
58             =item *
59              
60             Jerome Quelin
61              
62             =item *
63              
64             Ricardo Signes <rjbs@semiotic.systems>
65              
66             =back
67              
68             =head1 COPYRIGHT AND LICENSE
69              
70             This software is copyright (c) 2009 by Jerome Quelin.
71              
72             This is free software; you can redistribute it and/or modify it under
73             the same terms as the Perl 5 programming language system itself.
74              
75             =cut
76              
77             __END__
78              
79             #pod =head1 DESCRIPTION
80             #pod
81             #pod This scanner will check if a given test is using recent functions from
82             #pod L<Test::More>, and increase the minimum version for this module
83             #pod accordingly.
84             #pod