Don't try to calculate a time over the conservative failure boundary.
[p5sagit/p5-mst-13.2.git] / lib / Time / localtime.t
index 5d935e7..0b020fc 100644 (file)
@@ -7,29 +7,22 @@ BEGIN {
     require "./test.pl";
 }
 
+my(@times, @methods);
 BEGIN {
-    my $haslocal;
-    eval { my $n = localtime 0 };
-    $haslocal = 1 unless $@ && $@ =~ /unimplemented/;
+    @times   = (-2**55, -2**50, -2**33, -2**31-1, -1, 0, 1, 2**31-1, 2**33, 2**50, 2**55, time);
+    @methods = qw(sec min hour mday mon year wday yday isdst);
 
-    skip_all("no localtime") unless $haslocal;
-}
-
-BEGIN {
-    my @localtime = CORE::localtime 0; # This is the function localtime.
+    plan tests => (@times * (@methods + 1)) + 1;
 
-    skip_all("localtime failed") unless @localtime;
+    use_ok Time::localtime;
 }
 
-BEGIN { plan tests => 37; }
-
-BEGIN { use_ok Time::localtime; }
-
-for my $time (0, 2**31-1, 2**33, time) {
+for my $time (@times) {
     my $localtime = localtime $time;          # This is the OO localtime.
     my @localtime = CORE::localtime $time;    # This is the localtime function
 
-    for my $method (qw(sec min hour mday mon year wday yday isdst)) {
+    is @localtime, 9, "localtime($time)";
+    for my $method (@methods) {
         is $localtime->$method, shift @localtime, "localtime($time)->$method";
     }
 }