summaryrefslogtreecommitdiff
path: root/tests/ls-2
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-08-15 19:50:54 +0000
committerJim Meyering <jim@meyering.net>1998-08-15 19:50:54 +0000
commitd223f01b432dace09919ddb2cd5ed015da3a9989 (patch)
tree4ed5a257e74f75b48eec981c2df16fe67beba11b /tests/ls-2
parent3a2b5285731488582d6b0500b6588b9c6aad73e2 (diff)
downloadcoreutils-d223f01b432dace09919ddb2cd5ed015da3a9989.tar.xz
*** empty log message ***
Diffstat (limited to 'tests/ls-2')
-rw-r--r--tests/ls-2/T.pm54
1 files changed, 24 insertions, 30 deletions
diff --git a/tests/ls-2/T.pm b/tests/ls-2/T.pm
index da0b6a367..dbb16d4e1 100644
--- a/tests/ls-2/T.pm
+++ b/tests/ls-2/T.pm
@@ -11,7 +11,7 @@ use File::Compare qw(compare);
$VERSION = '0.5';
@EXPORT = qw (run_tests);
-my @Types = qw (OUT ERR EXIT);
+my @Types = qw (IN OUT ERR EXIT);
my %Types = map {$_ => 1} @Types;
my $count = 1;
@@ -74,41 +74,37 @@ sub run_tests ($$$$$)
my $exit_status;
my @args;
- my $arg;
- foreach $arg (@$t)
+ my $io_spec;
+ foreach $io_spec (@$t)
{
- if (!ref $arg)
+ if (!ref $io_spec)
{
- push @args, $arg;
+ push @args, $io_spec;
next;
}
- my $type;
- my $fs;
- if (ref $arg eq 'HASH')
- {
- my $n = keys %$arg;
- die "$program_name: $test_name: output spec has $n element --"
- . " expected 1\n"
- if $n != 1;
- ($type, $fs) = each %$arg;
- die "$program_name: $test_name: `$type': invalid in test spec\n"
- if ! $Types{$type};
- }
- elsif (ref $arg eq 'ARRAY')
- {
- my $n = @$arg;
- die "$program_name:: input file spec has $n element --"
- . " expected 1\n"
- if $n != 1;
- $fs = $arg->[0];
- $type = 'IN';
- }
- else
+ die "$program_name: $test_name: invalid test spec\n"
+ if ref $io_spec ne 'HASH';
+
+ my $n = keys %$io_spec;
+ die "$program_name: $test_name: spec has $n elements --"
+ . " expected 1\n"
+ if $n != 1;
+ my ($type, $val) = each %$io_spec;
+ die "$program_name: $test_name: invalid key `$type' in test spec\n"
+ if ! $Types{$type};
+
+ if ($type eq 'EXIT')
{
- die "$program_name: $test_name: invalid test spec\n";
+ # FIXME: make sure there's only one of these
+ # FIXME: make sure $data is numeric
+ $exit_status = $val;
+ next;
}
+ my $file_spec = $val;
+ my ($filename, $contents) = each %$file_spec;
+
if ($type =~ /_FILE$/ || $type =~ /_DATA$/)
{
my $file;
@@ -144,8 +140,6 @@ sub run_tests ($$$$$)
}
elsif ($type eq 'EXIT_STATUS')
{
- # FIXME: make sure there's only one of these
- # FIXME: make sure $data is numeric
$exit_status = $data;
}
else