File Coverage

t/05-abbreviate.t
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 27 27 100.0


line stmt bran cond sub pod time code
1 1     1   6 use strict;
  1         1  
  1         34  
2 1     1   4 use warnings;
  1         1  
  1         80  
3 1     1   594 use Test::More qw(no_plan);
  1         17125  
  1         12  
4              
5 1     1   1090 use DateTimeX::ISO8601::Interval;
  1         2  
  1         1665  
6              
7 1         3 my $c = 'DateTimeX::ISO8601::Interval';
8 1         12 my $interval = $c->parse('P1D', abbreviate => 1);
9 1         30 is "$interval", 'P1D', 'duration-only';
10              
11 1         667 $interval = $c->parse('2013-12-01/2013-12-04', abbreviate => 1);
12 1         10 is "$interval", '2013-12-01/04', 'start/end';
13 1         337 is $interval->abbreviate(0)->format, '2013-12-01/2013-12-04', 'abbreviate turned off';
14              
15 1         334 is $interval->abbreviate->format, '2013-12-01/04', 'abbreviate turned on';
16              
17 1         355 is $interval->abbreviate->format(abbreviate => 0), '2013-12-01/2013-12-04', 'abbreviate turned off (per invocation)';
18 1         315 is "$interval", '2013-12-01/04', 'per-invocation not sticky';
19 1         313 is $interval->abbreviate(0)->format(abbreviate => 1), '2013-12-01/04', 'abbreviate turned on (per invocation)';
20 1         309 is "$interval", '2013-12-01/2013-12-04', 'per-invocation not sticky';