Test/More.pm

filter: Statementstmt 34.0% 15 / 44 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 4 / 6 Podpod 50.0% 1 / 2 totaltotal 30.7% 20 / 65 CC 6 SCAR 27.1
CC
6
Cov
27%
generate_t
30.0
test
6.0
BEGIN
1.0
CRAP 15.1
« Object/Conf.pm ↑ Summary NotificationCenter.pm »
1 package Basset::Test::More;
2  
3 #Basset::Test::More, copyright and (c) 2004 James A Thomason III
4  
5 3 $VERSION = '1.00';
6  
7 3 ▶use Basset::Test;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 @ISA = qw(Basset::Test);
9  
10 3 ▶use Test::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =pod
16  
17 =head1 Basset::Test::More
18  
19 Basset::Test::More is a drop-in replacement for Basset::Test. Change the test type in your conf
20 file for a global change.
21  
22 Basset::Test will actually test all of your functions and spit out the output. Basset::Test::More
23 will generate (to STDOUT) a .t file suitable using Test::More suitable for running through Test::Harness.
24  
25 =cut
26  
27 0 ▶sub test {
Subroutine test: not called CC=2 SCAR=17.9
Pod documented
28 0 my $self = shift;
29 0 my $class = shift;
30 0 my $superclasses = shift;
31
32 0 $self->singleton(Test::Builder->new);
33  
34 0 $self->_output([]);
35  
36 0 $self->singleton->no_header(1);
37 0 $self->singleton->no_ending(1);
38
39 0 ▶ my @t = $self->get_all_tests($class, $superclasses) or return;
Branch: 1 branch
BranchTrueFalseTotal
my(@t) = $self->get_all_tests($class, $superclasses) or return 0 0 0
40  
41 0 my $plan = $self->plan();
42
43 0 print "use Test::More tests => $plan;\n";
44 0 print "use $class;\n";
45 0 print "package $class;\n";
46  
47 0 $self->generate_t($class, @t);
48 }
49  
50 0 ▶sub generate_t {
Subroutine generate_t: not called CC=5 SCAR=34.0
Pod undocumented
51 0 my $self = shift;
52 0 my $class = shift;
53 0 my @t = @_;
54
55 0 my $tfile = 1;
56  
57 #open (T, ">$tfile") || return $self->error("Could not open t file : $!", "BTM-01");
58 0 open(T, ">-");
59
60 0 ▶ while (@t) {
Branch: 1 branch
BranchTrueFalseTotal
if (@t) 0 0 0
61 0 my $n = shift @t;
62 0 my $test = shift (@t);
63 0 ▶ if (defined $test && $test =~ /\S/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $test and $test =~ /\S/) 0 0 0
Condition0%0/3
defined $test and $test =~ /\S/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $test and $test =~ /\S/
defined $test $test =~ /\S/
Truth table0%0/3
A and B
A= defined $testB= $test =~ /\S/
ABresult
0X0
100
111
64 0 ▶ next if $test =~ /^\s*#line \d+\s+\w+\s*$/s;
Branch: 1 branch
BranchTrueFalseTotal
if $test =~ /^\s*#line \d+\s+\w+\s*$/s 0 0 0
65 0 my $t = '{' . $test . '};';
66 0 $t =~ s/__PACKAGE__/$class/g;
67 0 $t =~ s/\$test->plan\(.+$//gm;
68 0 $t =~ s/\$test->/Test::More::/g;
69 0 print T "$t\n";
70 }
71 }
72
73 #close (T) || return $self->error("Could not close t file : $!", "BTM-02");
74
75 0 return $tfile;
76 }
77  
78 3 1;
« Object/Conf.pm ↑ Summary NotificationCenter.pm »