line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
866
|
use Test::More qw(no_plan); |
|
1
|
|
|
|
|
21491
|
|
|
1
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1118
|
use DateTimeX::ISO8601::Interval; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1873
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
|
|
11
|
my $interval = DateTimeX::ISO8601::Interval->new( |
8
|
|
|
|
|
|
|
start => DateTime->new(year => 2013, month => 12, day => 1), |
9
|
|
|
|
|
|
|
duration => DateTime::Duration->new( months => 1) |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
6
|
isa_ok $interval, 'DateTimeX::ISO8601::Interval'; |
13
|
1
|
|
|
|
|
754
|
isa_ok $interval->start, 'DateTime', 'start'; |
14
|
1
|
|
|
|
|
381
|
isa_ok $interval->end, 'DateTime', 'end'; |
15
|
1
|
|
|
|
|
908
|
isa_ok $interval->duration, 'DateTime::Duration', 'duration'; |
16
|
1
|
|
|
|
|
345
|
is $interval->repeat, 0, 'no repeat'; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
318
|
$interval->start( '2013-12-02'); |
19
|
1
|
|
|
|
|
26
|
is $interval->start->ymd, '2013-12-02', 'start setter'; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
339
|
$interval->end( '2013-12-09'); |
22
|
1
|
|
|
|
|
4
|
is $interval->end->ymd, '2013-12-10', 'end setter, moves to next day when precision is "date"'; |
23
|
1
|
|
|
|
|
343
|
is $interval->duration->weeks, 1, 'duration adjusted'; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
324
|
$interval->end(DateTime->new( year => 2013, month => 12, day => 9)); |
26
|
1
|
|
|
|
|
4
|
is $interval->end->ymd, '2013-12-09', 'end setter, leaves alone if DateTime provided'; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
322
|
$interval->end( '2013-12-09T11:00:23'); |
29
|
1
|
|
|
|
|
4
|
is $interval->end->ymd, '2013-12-09', 'end setter, leaves alone if time specified'; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
324
|
$interval->repeat(5); |
32
|
1
|
|
|
|
|
3
|
is $interval->repeat, 5, 'repeat setter'; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
359
|
$interval->set_time_zone('America/New_York'); |
35
|
1
|
|
|
|
|
6
|
is $interval->start->time_zone->name, 'America/New_York', 'expected time_zone'; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
521
|
$interval = DateTimeX::ISO8601::Interval->new( |
38
|
|
|
|
|
|
|
end => DateTime->new(year => 2013, month => 12, day => 1), |
39
|
|
|
|
|
|
|
duration => DateTime::Duration->new( months => 1) |
40
|
|
|
|
|
|
|
); |
41
|
1
|
|
|
|
|
14
|
ok exists $interval->{duration}, 'duration set'; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
326
|
is $interval->duration->months, 1, 'interval == 1 month'; |
44
|
1
|
|
|
|
|
318
|
is $interval->start->ymd, '2013-11-01', 'expected start date'; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
356
|
$interval->start('2013-11-30'); |
47
|
1
|
|
|
|
|
26
|
is $interval->duration->days, 2, 'interval is for two days'; |
48
|
1
|
|
|
|
|
353
|
ok !exists $interval->{duration}, 'duration no longer set'; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
312
|
my $success = eval { $interval->duration(DateTime::Duration->new( months => 1)); 1 }; |
|
1
|
|
|
|
|
5
|
|
|
0
|
|
|
|
|
0
|
|
51
|
1
|
|
|
|
|
34
|
ok !$success, 'duration not set-able when start/end already set'; |
52
|
1
|
|
|
|
|
336
|
delete $interval->{end}; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
2
|
$success = eval { $interval->duration('garbage'); 1 }; |
|
1
|
|
|
|
|
4
|
|
|
0
|
|
|
|
|
0
|
|
55
|
1
|
|
|
|
|
7
|
ok !$success, 'duration not set-able with invalid duration'; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
329
|
$interval->duration(DateTime::Duration->new( months => 1)); |
58
|
1
|
|
|
|
|
4
|
is $interval->duration->months, 1, 'duration set'; |