Commit | Line | Data |
---|---|---|
2857d2f7 JH |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
2857d2f7 | 6 | |
769448c3 | 7 | require "./test.pl"; |
2857d2f7 JH |
8 | } |
9 | ||
769448c3 | 10 | BEGIN { plan tests => 37; } |
2857d2f7 | 11 | |
769448c3 | 12 | BEGIN { use_ok Time::gmtime; } |
2857d2f7 | 13 | |
9b3ca67b MS |
14 | # Perl has its own gmtime() so it's safe to do negative times. |
15 | for my $time (-2**33, -2**31-1, 0, 2**31-1, 2**33, time) { | |
769448c3 MS |
16 | my $gmtime = gmtime $time; # This is the OO gmtime. |
17 | my @gmtime = CORE::gmtime $time; # This is the gmtime function | |
2857d2f7 | 18 | |
769448c3 MS |
19 | for my $method (qw(sec min hour mday mon year wday yday isdst)) { |
20 | is $gmtime->$method, shift @gmtime, "gmtime($time)->$method"; | |
21 | } | |
22 | } |