| 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
Condition33%1/3
$exceptions and $re
MC/DC0%0/2
$exceptions and $re
$exceptions
$re
Truth table33%1/3
A and B
A= $exceptionsB= $re
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||