File Coverage

inc/Test/Builder/Module.pm
Criterion Covered Total %
statement 32 33 96.9
branch 4 4 100.0
condition 2 3 66.6
subroutine 5 6 83.3
pod 2 2 100.0
total 45 48 93.7


line stmt bran cond sub pod time code
1             #line 1
2             package Test::Builder::Module;
3 19     19   91  
  19         32  
  19         821  
4             use strict;
5 19     19   13202  
  19         52  
  19         6231  
6             use Test::Builder;
7              
8             require Exporter;
9             our @ISA = qw(Exporter);
10              
11             our $VERSION = '0.94';
12             $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
13              
14              
15             #line 74
16              
17             sub import {
18             my($class) = shift;
19              
20             # Don't run all this when loading ourself.
21             return 1 if $class eq 'Test::Builder::Module';
22              
23             my $test = $class->builder;
24              
25             my $caller = caller;
26              
27             $test->exported_to($caller);
28              
29             $class->import_extra( \@_ );
30             my(@imports) = $class->_strip_imports( \@_ );
31              
32             $test->plan(@_);
33              
34             $class->export_to_level( 1, $class, @imports );
35             }
36              
37             sub _strip_imports {
38             my $class = shift;
39             my $list = shift;
40              
41             my @imports = ();
42             my @other = ();
43             my $idx = 0;
44             while( $idx <= $#{$list} ) {
45             my $item = $list->[$idx];
46              
47             if( defined $item and $item eq 'import' ) {
48             push @imports, @{ $list->[ $idx + 1 ] };
49             $idx++;
50             }
51             else {
52             push @other, $item;
53             }
54              
55             $idx++;
56             }
57              
58             @$list = @other;
59              
60             return @imports;
61             }
62              
63             #line 137
64              
65             sub import_extra { }
66              
67             #line 167
68              
69             sub builder {
70             return Test::Builder->new;
71             }
72              
73             1;