Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests to not die a month from Jan 31st
  • Loading branch information
Carl Masak committed Aug 23, 2015
1 parent e369518 commit 66a389d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion S32-temporal/Date.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S32::Temporal/C<Date>>

plan 72;
plan 73;

# construction
{
Expand Down Expand Up @@ -132,4 +132,5 @@ ok d('2011-01-14') ~~ d('2011-01-14'), 'Can smartmatch Date objects';
is d('2014-02-07').earlier(week => 1), d('2014-01-31'), 'subtracting 1 week, overflowing from February';
is d('2014-03-14').earlier(weeks => 2), d('2014-02-28'), 'subtracting 2 weeks, overflowing from March';
is d('2015-01-20').earlier(weeks => 3), d('2014-12-30'), 'subtracting 3 weeks, overflowing to years';
lives-ok { Date.new('2010-01-31').later(month => 1) }, '.later does not try to create an impossible date';
}
6 changes: 5 additions & 1 deletion S32-temporal/DateTime.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 233;
plan 234;

my $orwell = DateTime.new(year => 1984);

Expand Down Expand Up @@ -593,6 +593,10 @@ is DateTime.now.Date, Date.today, 'coercion to Date';
is ds('2015-01-20T12:56:34Z').earlier(weeks => 3),
ds('2014-12-30T12:56:34Z'),
'subtracting 3 weeks, overflowing to years';

lives-ok {
ds('2010-01-31T12:56:34Z').later(month => 1);
}, '.later does not try to create an impossible datetime';
}

# RT #121990 Smartmatch against a Date
Expand Down

0 comments on commit 66a389d

Please sign in to comment.