line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
3
|
1
|
|
|
1
|
|
537
|
use Test::More qw(no_plan); |
|
1
|
|
|
|
|
13591
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
768
|
use DateTimeX::ISO8601::Interval; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1877
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
|
|
3
|
ok !eval { DateTimeX::ISO8601::Interval->parse }, 'fails'; |
|
1
|
|
|
|
|
14
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
|
|
486
|
chomp(my @tests = ); |
10
|
1
|
|
|
|
|
6
|
foreach my $t(@tests) { |
11
|
30
|
100
|
|
|
|
7633
|
next if $t =~ /^(#.*|$)/; |
12
|
19
|
|
|
|
|
71
|
my($in,$out,$todo) = split(/\t/, $t); |
13
|
19
|
|
|
|
|
70
|
my $parsed = DateTimeX::ISO8601::Interval->parse($in); |
14
|
19
|
100
|
66
|
|
|
67
|
if($todo && $todo =~ s/TODO //) { |
15
|
2
|
|
|
|
|
5
|
TODO: { |
16
|
2
|
|
|
|
|
2
|
local $TODO = $todo; |
17
|
2
|
|
|
|
|
50
|
is "$parsed", "$out", "parsing $in == $out"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} else { |
20
|
17
|
|
|
|
|
41
|
is "$parsed", "$out", "parsing $in == $out"; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
352
|
my $interval = DateTimeX::ISO8601::Interval->parse('2013-04-15/2013-04-16', time_zone => 'America/New_York'); |
25
|
1
|
|
|
|
|
6
|
is $interval->start->time_zone->name, 'America/New_York', 'correct time_zone set'; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
562
|
$interval = DateTimeX::ISO8601::Interval->parse('2013-04-15/16', time_zone => 'America/New_York'); |
28
|
1
|
|
|
|
|
11
|
is $interval->duration->in_units('days'), 2, 'expected number of days'; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
493
|
$interval = DateTimeX::ISO8601::Interval->parse('2013-04-15/P1D', time_zone => 'America/New_York'); |
31
|
1
|
|
|
|
|
8
|
is $interval->duration->in_units('days'), 1, 'expected number of days'; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
379
|
my $success = eval { DateTimeX::ISO8601::Interval->parse('2013-12-01'); 1 }; |
|
1
|
|
|
|
|
5
|
|
|
0
|
|
|
|
|
0
|
|
34
|
1
|
|
|
|
|
7
|
ok !$success, 'failed on garbage input'; |
35
|
1
|
|
|
|
|
409
|
like $@, qr{Invalid interval: 2013-12-01}, 'expected error'; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
360
|
$success = eval { DateTimeX::ISO8601::Interval->parse('2013-01-01/P1D', time_zone => 'fake'); 1 }; |
|
1
|
|
|
|
|
6
|
|
|
0
|
|
|
|
|
0
|
|
38
|
1
|
|
|
|
|
5
|
ok !$success, 'failed on bogus time_zone'; |
39
|
1
|
|
|
|
|
342
|
like $@, qr{Invalid time_zone: fake}, 'expected error'; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__DATA__ |