X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FTime%2Flocaltime.t;h=8600eff3e7efc331acc25c72ba7a25a35e0d093d;hb=4c91ace1ab7f54d4e52467ee37e480e29b555047;hp=10df765fc3468cb0672c4ab5e87a8232094d5f5d;hpb=dc164757d6434bcc04e6bf2256aab2dea31afaa0;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Time/localtime.t b/lib/Time/localtime.t index 10df765..8600eff 100644 --- a/lib/Time/localtime.t +++ b/lib/Time/localtime.t @@ -8,30 +8,21 @@ BEGIN { } BEGIN { - my $haslocal; - eval { my $n = localtime 0 }; - $haslocal = 1 unless $@ && $@ =~ /unimplemented/; + @times = (-2**33, -2**31-1, 0, 2**31-1, 2**33, 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; - skip_all("localtime failed") unless @localtime; + use_ok Time::localtime; } -BEGIN { plan tests => 37; } - -BEGIN { use_ok Time::localtime; } - # Since Perl's localtime() still uses the system localtime, don't try # to do negative times. The system might not support it. -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)) { + for my $method (@methods) { is $localtime->$method, shift @localtime, "localtime($time)->$method"; } }