Inline/Content/Default.pm

filter: Statementstmt 100% 21 / 21 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 91.1% 31 / 34 CC 5 SCAR 12.8
CC
5
Cov
90%
process
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.6
« Inline/Content/Simple.pm ↑ Summary Inline/IO/File.pm »
1 package Test::Inline::Content::Default;
2 # ABSTRACT: est::Inline 2 fallback/default Content Handler
3  
4 #pod =pod
5 #pod
6 #pod =head1 DESCRIPTION
7 #pod
8 #pod This class implements the default generator for script content. It generates
9 #pod test script content inteded for use in a standard CPAN dist.
10 #pod
11 #pod This module contains no user servicable parts.
12 #pod
13 #pod =cut
14  
15 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 12 ▶use Params::Util qw{_INSTANCE};
Subroutine BEGIN: called CC=1 SCAR=0.0
17 12 ▶use Test::Inline::Content ();
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 12 our $VERSION = '2.214';
20 12 our @ISA = 'Test::Inline::Content';
21  
22 16 ▶sub process {
Subroutine process: called CC=5 SCAR=16.4
Pod documented
23 16 my $self = shift;
24 16 ▶ my $Inline = _INSTANCE(shift, 'Test::Inline') or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $Inline = &_INSTANCE(shift(), "Test::Inline") or return undef 16 0 16
25 16 ▶ my $Script = _INSTANCE(shift, 'Test::Inline::Script') or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $Script = &_INSTANCE(shift(), "Test::Inline::Script") or return undef 16 0 16
26  
27 # Get the merged content
28 16 my $content = $Script->merged_content;
29 16 ▶ return undef unless defined $content;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $content 0 16 16
30  
31 # Determine a plan
32 16 my $tests = $Script->tests;
33 16 ▶ my $plan = defined $tests
Branch: 1 branch
BranchTrueFalseTotal
defined $tests ? : 10 6 16
34 ? "tests => $tests"
35 : "'no_plan'";
36  
37 # Wrap the merged contents with the rest of the test
38 # file infrastructure.
39 16 my $file = <<"END_TEST";
40 #!/usr/bin/perl -w
41  
42 use strict;
43 use Test::More $plan;
44 \$| = 1;
45  
46  
47  
48 $content
49  
50  
51  
52 1;
53 END_TEST
54  
55 16 $file;
56 }
57  
58 12 1;
59  
60 __END__
« Inline/Content/Simple.pm ↑ Summary Inline/IO/File.pm »