line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Config::IOD; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
## no critic (Modules::ProhibitAutomaticExportation) |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
2668
|
use 5.010; |
|
6
|
|
|
|
|
53
|
|
6
|
6
|
|
|
6
|
|
27
|
use strict; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
166
|
|
7
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
149
|
|
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
2805
|
use Test::Differences; |
|
6
|
|
|
|
|
96114
|
|
|
6
|
|
|
|
|
436
|
|
10
|
6
|
|
|
6
|
|
2434
|
use Test::Exception; |
|
6
|
|
|
|
|
320892
|
|
|
6
|
|
|
|
|
23
|
|
11
|
6
|
|
|
6
|
|
4731
|
use Test::More; |
|
6
|
|
|
|
|
30892
|
|
|
6
|
|
|
|
|
49
|
|
12
|
6
|
|
|
6
|
|
4190
|
use Config::IOD; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
244
|
|
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
|
48
|
use Exporter qw(import); |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
1576
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
17
|
|
|
|
|
|
|
our $DATE = '2022-05-02'; # DATE |
18
|
|
|
|
|
|
|
our $DIST = 'Config-IOD'; # DIST |
19
|
|
|
|
|
|
|
our $VERSION = '0.353'; # VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @EXPORT = qw(test_modify_doc); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub test_modify_doc { |
24
|
49
|
|
|
49
|
1
|
78875
|
my $opts; |
25
|
49
|
100
|
|
|
|
153
|
if (ref($_[0]) eq 'HASH') { |
26
|
18
|
|
|
|
|
29
|
$opts = shift; |
27
|
|
|
|
|
|
|
} else { |
28
|
31
|
|
|
|
|
52
|
$opts = {}; |
29
|
|
|
|
|
|
|
} |
30
|
49
|
|
|
|
|
131
|
my ($code, $doc1, $doc2, $name) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
subtest +($name // "test_modify_doc") => sub { |
33
|
49
|
|
|
49
|
|
36969
|
my $iod = Config::IOD->new; |
34
|
49
|
|
|
|
|
1186
|
my $doc = $iod->read_string($doc1); |
35
|
49
|
100
|
|
|
|
130
|
if ($opts->{dies}) { |
36
|
18
|
50
|
|
|
|
95
|
dies_ok { $code->($doc) } "dies" |
|
18
|
|
|
|
|
545
|
|
37
|
|
|
|
|
|
|
or return 0; |
38
|
18
|
|
|
|
|
7741
|
return 1; |
39
|
|
|
|
|
|
|
} else { |
40
|
31
|
50
|
|
|
|
200
|
lives_ok { $code->($doc) } "lives" |
|
31
|
|
|
|
|
969
|
|
41
|
|
|
|
|
|
|
or return 0; |
42
|
|
|
|
|
|
|
} |
43
|
31
|
|
|
|
|
19521
|
eq_or_diff $doc->as_string, $doc2, "result"; |
44
|
49
|
|
50
|
|
|
291
|
}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
# ABSTRACT: Testing routines for Config::IOD |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |