RE: Untested libraries update
[p5sagit/p5-mst-13.2.git] / lib / Time / localtime.t
CommitLineData
2857d2f7 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8BEGIN {
9 our $haslocal;
10 eval { my $n = localtime 0 };
11 $haslocal = 1 unless $@ && $@ =~ /unimplemented/;
12 unless ($haslocal) { print "1..0 # Skip: no localtime\n"; exit 0 }
13}
14
15BEGIN {
16 our @localtime = localtime 0; # This is the function localtime.
17 unless (@localtime) { print "1..0 # Skip: localtime failed\n"; exit 0 }
18}
19
20print "1..10\n";
21
22use Time::localtime;
23
24print "ok 1\n";
25
26my $localtime = localtime 0 ; # This is the OO localtime.
27
28print "not " unless $localtime->sec == $localtime[0];
29print "ok 2\n";
30
31print "not " unless $localtime->min == $localtime[1];
32print "ok 3\n";
33
34print "not " unless $localtime->hour == $localtime[2];
35print "ok 4\n";
36
37print "not " unless $localtime->mday == $localtime[3];
38print "ok 5\n";
39
40print "not " unless $localtime->mon == $localtime[4];
41print "ok 6\n";
42
43print "not " unless $localtime->year == $localtime[5];
44print "ok 7\n";
45
46print "not " unless $localtime->wday == $localtime[6];
47print "ok 8\n";
48
49print "not " unless $localtime->yday == $localtime[7];
50print "ok 9\n";
51
52print "not " unless $localtime->isdst == $localtime[8];
53print "ok 10\n";
54
55
56
57