line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Data::Sah::Format; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2582
|
use 5.010001; |
|
2
|
|
|
|
|
7
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict 'subs', 'vars'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
56
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
906
|
use Data::Sah::Format; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
62
|
|
8
|
2
|
|
|
2
|
|
828
|
use Test::Exception; |
|
2
|
|
|
|
|
198376
|
|
|
2
|
|
|
|
|
11
|
|
9
|
2
|
|
|
2
|
|
2298
|
use Test::More 0.98; |
|
2
|
|
|
|
|
13195
|
|
|
2
|
|
|
|
|
24
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
920
|
use Exporter qw(import); |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
652
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(test_format); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub test_format { |
15
|
10
|
|
|
10
|
1
|
717197
|
my %args = @_; |
16
|
|
|
|
|
|
|
|
17
|
10
|
|
50
|
|
|
100
|
my $compiler = $args{compiler} // 'perl'; |
18
|
10
|
|
|
|
|
30
|
my $module; |
19
|
10
|
50
|
|
|
|
47
|
if ($compiler eq 'perl') { |
|
|
0
|
|
|
|
|
|
20
|
10
|
|
|
|
|
36
|
$module = "Data::Sah::Format"; |
21
|
|
|
|
|
|
|
} elsif ($compiler eq 'js') { |
22
|
0
|
|
|
|
|
0
|
$module = "Data::Sah::FormatJS"; |
23
|
|
|
|
|
|
|
} else { |
24
|
0
|
|
|
|
|
0
|
die "Unknown compiler '$compiler'"; |
25
|
|
|
|
|
|
|
} |
26
|
10
|
50
|
|
1
|
|
980
|
eval "use $module"; die if $@; |
|
10
|
|
|
1
|
|
63
|
|
|
1
|
|
|
1
|
|
8
|
|
|
1
|
|
|
1
|
|
17
|
|
|
1
|
|
|
1
|
|
27
|
|
|
1
|
|
|
1
|
|
11
|
|
|
1
|
|
|
1
|
|
3
|
|
|
1
|
|
|
1
|
|
24
|
|
|
1
|
|
|
1
|
|
13
|
|
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
23
|
|
27
|
|
|
|
|
|
|
|
28
|
10
|
|
|
|
|
25
|
my $formatter; |
29
|
|
|
|
|
|
|
subtest +($args{name} // $args{format}) => sub { |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
lives_ok { |
32
|
10
|
|
|
|
|
125
|
$formatter = &{"$module\::gen_formatter"}( |
33
|
|
|
|
|
|
|
format => $args{format}, |
34
|
|
|
|
|
|
|
formatter_args => $args{formatter_args}, |
35
|
10
|
|
|
|
|
550
|
); |
36
|
10
|
|
|
10
|
|
14668
|
}; |
37
|
10
|
50
|
|
|
|
7226
|
if (exists $args{data}) { |
38
|
10
|
|
|
|
|
58
|
for my $i (0..$#{ $args{data} }) { |
|
10
|
|
|
|
|
68
|
|
39
|
18
|
|
|
|
|
5411
|
my $data = $args{data}[$i]; |
40
|
18
|
|
|
|
|
557
|
my $fdata = $formatter->($data); |
41
|
18
|
|
|
|
|
1830
|
is_deeply($fdata, $args{fdata}[$i]); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
10
|
|
66
|
|
|
162
|
}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
# ABSTRACT: Test routines for testing Data::Sah::Format::* modules |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=encoding UTF-8 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Test::Data::Sah::Format - Test routines for testing Data::Sah::Format::* modules |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This document describes version 0.003 of Test::Data::Sah::Format (from Perl distribution Data-Sah-Format), released on 2017-07-10. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 FUNCTIONS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 test_format(%args) |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 HOMEPAGE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah-Format>. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SOURCE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-Sah-Format>. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 BUGS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-Format> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
81
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
82
|
|
|
|
|
|
|
feature. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This software is copyright (c) 2017, 2016 by perlancar@cpan.org. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
93
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |