File Coverage

inc/Test/Builder/Module.pm
Criterion Covered Total %
statement 29 32 90.6
branch 3 4 75.0
condition 1 3 33.3
subroutine 5 6 83.3
pod 2 2 100.0
total 40 47 85.1


line stmt bran cond sub pod time code
1             #line 1
2             package Test::Builder::Module;
3 1     1   3  
  1         1  
  1         23  
4             use strict;
5 1     1   401  
  1         17  
  1         224  
6             use Test::Builder 1.00;
7              
8             require Exporter;
9             our @ISA = qw(Exporter);
10              
11             our $VERSION = '1.001014';
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;