Commit 76d5520c authored by Chris Lamb's avatar Chris Lamb 💬

t/fixtures.t: Add a lookup table for descriptions of stat(1) indices.

parent 5a2c35dc
......@@ -29,6 +29,23 @@ use File::Temp qw(tempdir);
use File::StripNondeterminism;
use Test::More;
# perlfunc(1)
my %STAT = (
0 => "dev (device number of filesystem)",
1 => "ino (inode number)",
2 => "mode (file mode (type and permissions))",
3 => "nlink (number of hard links to the file)",
4 => "uid (numeric user ID of file's owner)",
5 => "gid (numeric group ID of file's owner)",
6 => "rdev (the device identifier; special files only)",
# 7 => "size (total size of file, in bytes)",
# 8 => "atime (last access time in seconds since the epoch)",
# 9 => "mtime (last modified time in seconds since the epoch)",
# 10 => "ctime (inode change time in seconds since the epoch)",
11 => "blksize (preferred I/O size in bytes for interacting with the file)",
12 => "blocks (actual number of system-specific blocks allocated on disk)",
);
$File::StripNondeterminism::canonical_time = 1423159771;
my @fixtures = glob('t/fixtures/*/*.in');
......@@ -54,14 +71,8 @@ foreach my $filename (@fixtures) {
my @stat_after = lstat $in;
# Check that file attributes remain unchanged.
foreach (my $i = 0; $i < @stat_after; $i++) {
next if (
$i == 7 # size
|| $i == 8 # atime
|| $i == 9 # mtime
|| $i == 10 # ctime
);
is($stat_before[$i], $stat_after[$i], "$filename: stat[$i]");
foreach my $i (sort keys %STAT) {
is($stat_before[$i], $stat_after[$i], "$filename: $STAT{$i}");
}
ok(compare($in, $out) == 0, "Got expected output");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment