Re: Why t/lib/extutils.t is failing (was Re: [PATCH] Re: [PATCH] Re: [SPAM] Re:...
[p5sagit/p5-mst-13.2.git] / t / lib / filestat.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7
8 BEGIN {
9     our $hasst;
10     eval { my @n = stat "TEST" };
11     $hasst = 1 unless $@ && $@ =~ /unimplemented/;
12     unless ($hasst) { print "1..0 # Skip: no stat\n"; exit 0 }
13     use Config;
14     $hasst = 0 unless $Config{'i_sysstat'} eq 'define';
15     unless ($hasst) { print "1..0 # Skip: no sys/stat.h\n"; exit 0 }
16 }
17
18 BEGIN {
19     our @stat = stat "TEST"; # This is the function stat.
20     unless (@stat) { print "1..0 # Skip: no file TEST\n"; exit 0 }
21 }
22
23 print "1..14\n";
24
25 use File::stat;
26
27 print "ok 1\n";
28
29 my $stat = stat "TEST"; # This is the OO stat.
30
31 print "not " unless $stat->dev     == $stat[ 0];
32 print "ok 2\n";
33
34 print "not " unless $stat->ino     == $stat[ 1];
35 print "ok 3\n";
36
37 print "not " unless $stat->mode    == $stat[ 2];
38 print "ok 4\n";
39
40 print "not " unless $stat->nlink   == $stat[ 3];
41 print "ok 5\n";
42
43 print "not " unless $stat->uid     == $stat[ 4];
44 print "ok 6\n";
45
46 print "not " unless $stat->gid     == $stat[ 5];
47 print "ok 7\n";
48
49 print "not " unless $stat->rdev    == $stat[ 6];
50 print "ok 8\n";
51
52 print "not " unless $stat->size    == $stat[ 7];
53 print "ok 9\n";
54
55 print "not " unless $stat->atime   == $stat[ 8];
56 print "ok 10\n";
57
58 print "not " unless $stat->mtime   == $stat[ 9];
59 print "ok 11\n";
60
61 print "not " unless $stat->ctime   == $stat[10];
62 print "ok 12\n";
63
64 print "not " unless $stat->blksize == $stat[11];
65 print "ok 13\n";
66
67 print "not " unless $stat->blocks  == $stat[12];
68 print "ok 14\n";
69
70 # Testing pretty much anything else is unportable.