This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge branch 'vincent/rvalue_stmt_given' into blead
[perl5.git] / lib / Time / localtime.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6
7     require "./test.pl";
8 }
9
10 my(@times, @methods);
11 BEGIN {
12     @times   = (-2**55, -2**50, -2**33, -2**31-1, -1, 0, 1, 2**31-1, 2**33, 2**50, 2**55, time);
13     @methods = qw(sec min hour mday mon year wday yday isdst);
14
15     plan tests => (@times * (@methods + 1)) + 1;
16
17     use_ok Time::localtime;
18 }
19
20 for my $time (@times) {
21     my $localtime = localtime $time;          # This is the OO localtime.
22     my @localtime = CORE::localtime $time;    # This is the localtime function
23
24     is @localtime, 9, "localtime($time)";
25     for my $method (@methods) {
26         is $localtime->$method, shift @localtime, "localtime($time)->$method";
27     }
28 }