line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::DateTime::Format::Alami; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
5001
|
use 5.010001; |
|
2
|
|
|
|
|
9
|
|
4
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
52
|
|
5
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1663
|
use DateTime; |
|
2
|
|
|
|
|
1003905
|
|
|
2
|
|
|
|
|
108
|
|
8
|
2
|
|
|
2
|
|
1187
|
use Test::More 0.98; |
|
2
|
|
|
|
|
105030
|
|
|
2
|
|
|
|
|
17
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
533
|
use Exporter qw(import); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
757
|
|
11
|
|
|
|
|
|
|
our @EXPORT = qw(test_datetime_format_alami); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub test_datetime_format_alami { |
14
|
2
|
|
|
2
|
1
|
356
|
my ($class0, $tests) = @_; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
10
|
my $class = "DateTime::Format::Alami::$class0"; |
17
|
2
|
50
|
|
2
|
|
1075
|
eval "use $class"; die if $@; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
39
|
|
|
2
|
|
|
|
|
123
|
|
|
2
|
|
|
|
|
10
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
subtest "test suite for $class" => sub { |
20
|
2
|
|
|
2
|
|
2908
|
my $parser = $class->new; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
6
|
for my $t (@{ $tests->{parse_datetime_tests} }) { |
|
2
|
|
|
|
|
9
|
|
23
|
90
|
|
|
|
|
180723
|
my ($str, $exp_result) = @$t; |
24
|
|
|
|
|
|
|
subtest $str => sub { |
25
|
90
|
|
|
|
|
88163
|
my $dt; |
26
|
90
|
|
|
|
|
189
|
eval { $dt = $parser->parse_datetime( |
27
|
90
|
|
|
|
|
579
|
$str, {time_zone => $tests->{time_zone}}) }; |
28
|
90
|
|
|
|
|
308
|
my $err = $@; |
29
|
90
|
100
|
|
|
|
248
|
if ($exp_result) { |
30
|
82
|
50
|
|
|
|
441
|
ok(!$err, "parse should succeed") or return; |
31
|
82
|
|
|
|
|
48612
|
is("$dt", $exp_result, "result should be $exp_result"); |
32
|
|
|
|
|
|
|
} else { |
33
|
8
|
|
|
|
|
39
|
ok($err, "parse should fail"); |
34
|
8
|
|
|
|
|
3639
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
90
|
|
|
|
|
773
|
}; |
37
|
|
|
|
|
|
|
} # parse_datetime_tests |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
4890
|
require DateTime::Format::Duration::ISO8601; |
40
|
2
|
|
|
|
|
612
|
my $pdur = DateTime::Format::Duration::ISO8601->new; |
41
|
2
|
|
|
|
|
14
|
for my $t (@{ $tests->{parse_datetime_duration_tests} }) { |
|
2
|
|
|
|
|
9
|
|
42
|
6
|
|
|
|
|
6488
|
my ($str, $exp_result) = @$t; |
43
|
|
|
|
|
|
|
subtest $str => sub { |
44
|
6
|
|
|
|
|
5581
|
my $dtdur; |
45
|
6
|
|
|
|
|
12
|
eval { $dtdur = $parser->parse_datetime_duration($str) }; |
|
6
|
|
|
|
|
28
|
|
46
|
6
|
|
|
|
|
14
|
my $err = $@; |
47
|
6
|
100
|
|
|
|
15
|
if ($exp_result) { |
48
|
4
|
50
|
|
|
|
16
|
ok(!$err, "parse should succeed") or return; |
49
|
4
|
|
|
|
|
1933
|
is($pdur->format_duration($dtdur), $exp_result, |
50
|
|
|
|
|
|
|
"result should be $exp_result"); |
51
|
|
|
|
|
|
|
} else { |
52
|
2
|
|
|
|
|
12
|
ok($err, "parse should fail"); |
53
|
2
|
|
|
|
|
871
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
6
|
|
|
|
|
48
|
}; |
56
|
|
|
|
|
|
|
} # parse_datetime_duration_tests |
57
|
2
|
|
|
|
|
29
|
}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
# ABSTRACT: Test DateTime::Format::Alami |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=encoding UTF-8 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Test::DateTime::Format::Alami - Test DateTime::Format::Alami |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 VERSION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This document describes version 0.14 of Test::DateTime::Format::Alami (from Perl distribution DateTime-Format-Alami), released on 2017-04-25. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 FUNCTIONS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 test_datetime_format_alami($class, \%tests) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 HOMEPAGE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/DateTime-Format-Alami>. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SOURCE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-DateTime-Format-Alami>. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 BUGS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Format-Alami> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
94
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
95
|
|
|
|
|
|
|
feature. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 AUTHOR |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This software is copyright (c) 2017, 2016, 2014 by perlancar@cpan.org. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
106
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |