diff options
author | Jim Meyering <jim@meyering.net> | 1998-08-15 20:33:18 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-08-15 20:33:18 +0000 |
commit | a302182ac8b48f111bbbff291b147116494d5108 (patch) | |
tree | 7077f8a1cebbe720f557291038163c858831dad8 /tests/ls-2/T.pm | |
parent | 6b0411ab473b56baf8c8638a780b73583bb8708a (diff) | |
download | coreutils-a302182ac8b48f111bbbff291b147116494d5108.tar.xz |
*** empty log message ***
Diffstat (limited to 'tests/ls-2/T.pm')
-rw-r--r-- | tests/ls-2/T.pm | 28 |
1 files changed, 18 insertions, 10 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}; } |