Given.pm

filter: Statementstmt 100% 38 / 38 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 15 / 15 Podpod 87.5% 7 / 8 totaltotal 91.1% 62 / 68 CC 3 SCAR 3.4
CC
3
Cov
93%
has_failed
3.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Given/Check.pm ↑ Summary Given/Builder.pm »
1 package Test::Given;
2 41 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 41 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 41 ▶use Test::Given::Context;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 41 ▶use Test::Given::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 41 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 41 require Exporter;
10 41 our @ISA = qw(Exporter);
11 41 our @EXPORT = qw(describe context Given When Then And Invariant onDone has_failed);
12 }
13  
14 41 ▶use version; our $VERSION = qv('0.3.1');
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 41 my $context = Test::Given::Context->new('** TOPLEVEL **');
17 93 ▶sub describe {
Subroutine describe: called CC=1 SCAR=0.0
Pod undocumented
18 93 my ($description, $sub) = @_;
19 93 $context = $context->add_context($description);
20 93 $sub->();
21 90 $context = $context->parent();
22 }
23 41 *context = \&describe;
24  
25 99 ▶sub Given { $context->add_given(@_) }
Subroutine Given: called CC=1 SCAR=0.0
Pod documented
26 20 ▶sub When { $context->add_when(@_) }
Subroutine When: called CC=1 SCAR=0.0
Pod documented
27 29 ▶sub Invariant { $context->add_invariant(@_) }
Subroutine Invariant: called CC=1 SCAR=0.0
Pod documented
28 133 ▶sub Then { $context->add_then(@_) }
Subroutine Then: called CC=1 SCAR=0.0
Pod documented
29 8 ▶sub onDone { $context->add_done(@_) }
Subroutine onDone: called CC=1 SCAR=0.0
Pod documented
30 82 ▶sub And { $context->add_and(@_) }
Subroutine And: called CC=1 SCAR=0.0
Pod documented
31  
32 5 ▶sub has_failed {
Subroutine has_failed: called CC=3 SCAR=12.0
Pod documented
33 5 my ($exceptions, $re) = @_;
34 5 ▶ return '' unless $exceptions and $re;
Branch: 1 branch
BranchTrueFalseTotal
unless $exceptions and $re 0 5 5
Condition33%1/3
$exceptions and $re
!ll&&!rl&&r
005
MC/DC0%0/2
$exceptions and $re
$exceptions $re
Truth table33%1/3
A and B
A= $exceptionsB= $re
ABresult
0X0
100
111
35 5 grep { $_ =~ $re } @$exceptions;
36 }
37  
38 41 ▶END {
Subroutine END: called CC=1 SCAR=0.0
39 41 plan(tests => $context->test_count());
40 39 $context->run_tests();
41 }
42  
43 41 1;
44  
45 __END__
« Given/Check.pm ↑ Summary Given/Builder.pm »