line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
1
|
|
|
1
|
|
909
|
use Test::More qw(no_plan); |
|
1
|
|
|
|
|
20929
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
933
|
use DateTimeX::ISO8601::Interval; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
50
|
|
6
|
1
|
|
|
1
|
|
11
|
use DateTime::Format::ISO8601; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2910
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
|
|
3
|
ok !eval { DateTimeX::ISO8601::Interval->parse }, 'fails'; |
|
1
|
|
|
|
|
17
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
789
|
my $parser = DateTime::Format::ISO8601->new; |
11
|
1
|
|
|
|
|
118
|
chomp(my @tests = ); |
12
|
1
|
|
|
|
|
5
|
foreach my $t(@tests) { |
13
|
13
|
100
|
|
|
|
4196
|
next if $t =~ /^(#.*|$)/; |
14
|
8
|
|
|
|
|
39
|
my($interval,$criteria,$date) = split(/\t/, $t); |
15
|
8
|
|
|
|
|
43
|
my $parsed = DateTimeX::ISO8601::Interval->parse($interval); |
16
|
8
|
100
|
|
|
|
25
|
if($criteria eq 'contains') { |
17
|
6
|
|
|
|
|
19
|
ok $parsed->contains($parser->parse_datetime($date)), "$parsed $criteria $date"; |
18
|
|
|
|
|
|
|
} else { |
19
|
2
|
|
|
|
|
10
|
ok !$parsed->contains($parser->parse_datetime($date)), "$parsed $criteria $date"; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
549
|
my $interval = DateTimeX::ISO8601::Interval->parse('P7D'); |
24
|
1
|
|
|
|
|
3
|
my $success = eval { $interval->contains('2013-01-01'); 1 }; |
|
1
|
|
|
|
|
5
|
|
|
0
|
|
|
|
|
0
|
|
25
|
1
|
|
|
|
|
4
|
ok !$success, 'contains fails if no start/end'; |
26
|
1
|
|
|
|
|
360
|
like $@, qr{Unable to determine}, 'expected error'; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
398
|
$interval->start('2013-01-01'); |
29
|
1
|
|
|
|
|
29
|
ok $interval->contains('2013-01-01'), 'contains works with start date'; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
1092
|
delete $interval->{start}; |
32
|
1
|
|
|
|
|
5
|
$interval->end('2013-01-10'); |
33
|
1
|
|
|
|
|
5
|
ok $interval->contains('2013-01-04'), 'contains works with end date'; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__DATA__ |