File Coverage

inc/Test/Builder/Module.pm
Criterion Covered Total %
statement 32 33 96.9
branch 3 4 75.0
condition 1 3 33.3
subroutine 5 6 83.3
pod 2 2 100.0
total 43 48 89.5


line stmt bran cond sub pod time code
1             #line 1
2             package Test::Builder::Module;
3 6     6   40  
  6         15  
  6         200  
4             use strict;
5 6     6   3178  
  6         25  
  6         2075  
6             use Test::Builder;
7              
8             require Exporter;
9             our @ISA = qw(Exporter);
10              
11             our $VERSION = '1.302073';
12              
13              
14             #line 73
15              
16             sub import {
17             my($class) = shift;
18              
19             # Don't run all this when loading ourself.
20             return 1 if $class eq 'Test::Builder::Module';
21              
22             my $test = $class->builder;
23              
24             my $caller = caller;
25              
26             $test->exported_to($caller);
27              
28             $class->import_extra( \@_ );
29             my(@imports) = $class->_strip_imports( \@_ );
30              
31             $test->plan(@_);
32              
33             local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;
34             $class->Exporter::import(@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;