]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
*** empty log message ***
authorJim Meyering <jim@meyering.net>
Sat, 15 Aug 1998 20:33:18 +0000 (20:33 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 15 Aug 1998 20:33:18 +0000 (20:33 +0000)
tests/ls-2/T.pm
tests/ls-2/quoting

index e59a3b3694697707ceee0f58d323c4eed7e6e8d7..de602afadc46c5bbe6b13e6a82cb47030c237928 100644 (file)
@@ -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};
            }
index 501df563ddc1c57f2247d8820e2ad54984a5fd6e..8bc3dad880f0767177d1f9acb2874df4194ea62b 100755 (executable)
@@ -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);