summaryrefslogtreecommitdiff
path: root/tests/ls-2
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-08-15 20:33:18 +0000
committerJim Meyering <jim@meyering.net>1998-08-15 20:33:18 +0000
commita302182ac8b48f111bbbff291b147116494d5108 (patch)
tree7077f8a1cebbe720f557291038163c858831dad8 /tests/ls-2
parent6b0411ab473b56baf8c8638a780b73583bb8708a (diff)
downloadcoreutils-a302182ac8b48f111bbbff291b147116494d5108.tar.xz
*** empty log message ***
Diffstat (limited to 'tests/ls-2')
-rw-r--r--tests/ls-2/T.pm28
-rwxr-xr-xtests/ls-2/quoting4
2 files changed, 20 insertions, 12 deletions
diff --git a/tests/ls-2/T.pm b/tests/ls-2/T.pm
index e59a3b369..de602afad 100644
--- a/tests/ls-2/T.pm
+++ b/tests/ls-2/T.pm
@@ -15,24 +15,25 @@ my @Types = qw (IN OUT ERR EXIT);
my %Types = map {$_ => 1} @Types;
my %Zero_one_type = map {$_ => 1} qw (OUT ERR EXIT);
-my $count = 1;
+my $Global_count = 1;
-sub _create_file ($$$$)
+sub _create_file ($$$$$)
{
- my ($program_name, $test_name, $file_name, $data) = @_;
- my $file = "$test_name-$$.$count";
+ my ($program_name, $test_name, $type, $file_name, $data) = @_;
+ my $file;
if (defined $file_name)
{
$file = $file_name;
}
else
{
- $file = "$test_name-$$.$count";
- ++$count;
+ $file = "$test_name-$$.$Global_count";
+ ++$Global_count;
}
# The test spec gave a string.
# Write it to a temp file and return tempfile name.
+ #warn "writing $type `$data' to $file\n";
my $fh = new FileHandle "> $file";
die "$program_name: $file: $!\n" if ! $fh;
print $fh $data;
@@ -79,6 +80,7 @@ sub run_tests ($$$$$)
my $test_name = shift @$t;
my $expect = {};
+ $Global_count = 1;
my @args;
my $io_spec;
my %seen_type;
@@ -132,10 +134,16 @@ sub run_tests ($$$$$)
}
my $is_junk_file = (! defined $file_name);
- my $file = _create_file ($program_name, $test_name,
+ my $file = _create_file ($program_name, $test_name, $type,
$file_name, $contents);
- push @args, $file
- if $type eq 'IN';
+ if ($type eq 'IN')
+ {
+ push @args, $file
+ }
+ else
+ {
+ $expect->{$type} = $file;
+ }
if ($is_junk_file)
{
@@ -159,7 +167,7 @@ sub run_tests ($$$$$)
{
if (!exists $expect->{$eo})
{
- $expect->{$eo} = _create_file ($program_name, $test_name,
+ $expect->{$eo} = _create_file ($program_name, $test_name, $eo,
undef, '');
push @junk_files, $expect->{$eo};
}
diff --git a/tests/ls-2/quoting b/tests/ls-2/quoting
index 501df563d..8bc3dad88 100755
--- a/tests/ls-2/quoting
+++ b/tests/ls-2/quoting
@@ -33,7 +33,7 @@ my $program_name;
# on stdout (or stderr).
# If the EXIT-keyed one is omitted, then expect the exit status to be zero.
-my $q_bell = {IN => {"q\a" => ''}}
+my $q_bell = {IN => {"q\a" => ''}};
my @Tests =
(
# test-name options input expected-output
@@ -51,7 +51,7 @@ my @Tests =
);
my $save_temps = 0;
-my $verbose = 0;
+my $verbose = $ENV{VERBOSE};
my $prog = $ENV{LS} || 'ls';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);