summaryrefslogtreecommitdiff
path: root/cpan/Time-Piece/t
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2010-06-26 15:04:03 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2010-06-26 15:04:03 +0100
commit90d55c29481047f2784ec1daadd553c5710e090a (patch)
tree5296d5b2bfd4ffa1c5b8651d9c5882065275b2ff /cpan/Time-Piece/t
parent1db4d19556a36b5a8e8604c1e7656999ebc7732b (diff)
downloadperl-90d55c29481047f2784ec1daadd553c5710e090a.tar.gz
Update Time-Piece to CPAN version 1.20
[DELTA] 1.20 - Fix for alloca broke Solaris - Fixed documentation buggette about strptime - Added ->pretty() method for Time::Seconds objects - Add %s support to strptime 1.19 - Fix for alloca broke FreeBSD 1.18 - Fix for alloca on IRIX 1.17 - Force all to use internal strptime then everyone gets %z even OSX users. - Finally figured out the timezone test failures on Win32 and fixed them. 1.16 - Implement %z for the internal implementation of strptime(). Unfortunately this doesn't get picked up everywhere, so there are no tests for it (yet - patches welcome). - Fix for major bug in add_months() using negative months which were multiples of 12. Also affected add_years() with negative years. - Fix for object creation bug in get_epochs which called new from object but that wasn't supported in the new() code. - Added docs about the weakness of using epoch seconds internally and suggested alternatives. - Removed useless "use UNIVERSAL qw(isa)" line. - Fix for installing over core perl version.
Diffstat (limited to 'cpan/Time-Piece/t')
-rw-r--r--cpan/Time-Piece/t/02core.t1
-rw-r--r--cpan/Time-Piece/t/07arith.t23
2 files changed, 23 insertions, 1 deletions
diff --git a/cpan/Time-Piece/t/02core.t b/cpan/Time-Piece/t/02core.t
index 5610bcb74d..8a0673e5f9 100644
--- a/cpan/Time-Piece/t/02core.t
+++ b/cpan/Time-Piece/t/02core.t
@@ -219,3 +219,4 @@ cmp_ok(
'==',
951827696
);
+
diff --git a/cpan/Time-Piece/t/07arith.t b/cpan/Time-Piece/t/07arith.t
index c4836a96b8..7f16bd13ae 100644
--- a/cpan/Time-Piece/t/07arith.t
+++ b/cpan/Time-Piece/t/07arith.t
@@ -1,4 +1,4 @@
-use Test::More tests => 13;
+use Test::More tests => 25;
BEGIN { use_ok('Time::Piece'); }
@@ -24,3 +24,24 @@ my $t4 = $t->add_years(1);
is($t4->year, 2001);
is($t4->mon, 3);
is($t4->mday, 1);
+
+$t = Time::Piece->strptime("01 01 2010","%d %m %Y");
+my $t6 = $t->add_months(-12);
+is($t6->year, 2009);
+is($t6->mon, 1);
+is($t6->mday, 1);
+
+my $t7 = $t->add_months(-1);
+is($t7->year, 2009);
+is($t7->mon, 12);
+is($t7->mday, 1);
+
+my $t8 = $t->add_months(-240);
+is($t8->year, 1990);
+is($t8->mon, 1);
+is($t8->mday, 1);
+
+my $t9 = $t->add_months(-13);
+is($t9->year, 2008);
+is($t9->mon, 12);
+is($t9->mday, 1);