| 1 | package Test::Config::IOD; | ||||||||||||
| 2 | |||||||||||||
| 3 | ## no critic (Modules::ProhibitAutomaticExportation) | ||||||||||||
| 4 | |||||||||||||
| 5 | 7 | ▶ | use 5.010; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 7 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 7 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 7 | ▶ | use Test::Differences; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 7 | ▶ | use Test::Exception; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 7 | ▶ | use Test::More; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 7 | ▶ | use Config::IOD; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | |||||||||||||
| 14 | 7 | ▶ | use Exporter qw(import); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | |||||||||||||
| 16 | 7 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||
| 17 | 7 | our $DATE = '2022-05-02'; # DATE | |||||||||||
| 18 | 7 | our $DIST = 'Config-IOD'; # DIST | |||||||||||
| 19 | 7 | our $VERSION = '0.353'; # VERSION | |||||||||||
| 20 | |||||||||||||
| 21 | 7 | our @EXPORT = qw(test_modify_doc); | |||||||||||
| 22 | |||||||||||||
| 23 | 49 | ▶ | sub test_modify_doc { | ||||||||||
|
Subroutine
test_modify_doc: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 24 | 49 | my $opts; | |||||||||||
| 25 | 49 | ▶ | if (ref($_[0]) eq 'HASH') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 26 | 18 | $opts = shift; | |||||||||||
| 27 | } else { | ||||||||||||
| 28 | 31 | $opts = {}; | |||||||||||
| 29 | } | ||||||||||||
| 30 | 49 | my ($code, $doc1, $doc2, $name) = @_; | |||||||||||
| 31 | |||||||||||||
| 32 | 49 | ▶ | subtest +($name // "test_modify_doc") => sub { | ||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||
| 33 | 49 | my $iod = Config::IOD->new; | |||||||||||
| 34 | 49 | my $doc = $iod->read_string($doc1); | |||||||||||
| 35 | 49 | ▶ | if ($opts->{dies}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 36 | 18 | ▶ | dies_ok { $code->($doc) } "dies" | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||
| 37 | or return 0; | ||||||||||||
| 38 | 18 | return 1; | |||||||||||
| 39 | } else { | ||||||||||||
| 40 | 31 | ▶ | lives_ok { $code->($doc) } "lives" | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||
| 41 | or return 0; | ||||||||||||
| 42 | } | ||||||||||||
| 43 | 31 | eq_or_diff $doc->as_string, $doc2, "result"; | |||||||||||
| 44 | 49 | ▶ | }; | ||||||||||
|
Condition50%1/2
$name // "test_modify_doc"
MC/DC0%0/1
$name // "test_modify_doc"
$name
Truth table50%1/2
A
A= $name
| |||||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 7 | 1; | |||||||||||
| 48 | # ABSTRACT: Testing routines for Config::IOD | ||||||||||||
| 49 | |||||||||||||
| 50 | __END__ | ||||||||||||