texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: tp/t/test_utils.pl: with -o more relevant extensi


From: Patrice Dumas
Subject: branch master updated: tp/t/test_utils.pl: with -o more relevant extensions, check overwritten files
Date: Thu, 01 Sep 2022 17:12:19 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new ce7dc5cf4d tp/t/test_utils.pl: with -o more relevant extensions, check 
overwritten files
ce7dc5cf4d is described below

commit ce7dc5cf4da7ec2761b0bab792e82170861fdab6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Sep 1 23:11:09 2022 +0200

    tp/t/test_utils.pl: with -o more relevant extensions, check
    overwritten files
---
 tp/t/test_utils.pl | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 0e492097dd..facada228a 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -129,6 +129,9 @@ if (defined($locale_encoding)) {
   binmode $builder->todo_output,    ":encoding($locale_encoding)";
 }
 
+# used to check that there are no file overwritten with -o
+my %output_files;
+
 ok(1);
 
 my %formats = (
@@ -1127,15 +1130,22 @@ sub test($$)
         mkdir ("$output_files_dir/$self->{'name'}")
           if (! -d "$output_files_dir/$self->{'name'}");
         my $extension;
-        if ($extensions{$format}) {
-          $extension = $extensions{$format};
+        if ($extensions{$format_type}) {
+          $extension = $extensions{$format_type};
         } else {
-          $extension = $format;
+          $extension = $format_type;
         }
 
         if (defined ($converted{$format})) {
-          my $outfile
-            = "$output_files_dir/$self->{'name'}/$test_name.$extension";
+          my $test_outfile = "$self->{'name'}/$test_name.$extension";
+          my $outfile = "$output_files_dir/$test_outfile";
+          if ($output_files{$test_outfile}) {
+            warn "$format: $test_name: overwrite $outfile "
+                     ."(".join("|", @{$output_files{$test_outfile}}).")\n";
+            push @{$output_files{$test_outfile}}, $format;
+          } else {
+            $output_files{$test_outfile} = [$format];
+          }
           if (!open (OUTFILE, ">$outfile")) {
             warn "Open $outfile: $!\n";
           } else {
@@ -1178,7 +1188,7 @@ sub test($$)
         }
         if ($converted_errors{$format}) {
           my $errors_file
-            = "$output_files_dir/$self->{'name'}/${test_name}_$extension.err";
+            = "$output_files_dir/$self->{'name'}/${test_name}_$format.err";
           if (!open (ERRFILE, ">$errors_file")) {
             warn "Open $errors_file: $!\n";
           } else {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]