texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/t/converters_tests.t: warn file_* tests with


From: Patrice Dumas
Subject: branch master updated: * tp/t/converters_tests.t: warn file_* tests with output as text returned from the converter. It is most probably wrong because the empty directories and files are compared instead of the test returned. Avoid files being overwritten with -o and warn.
Date: Fri, 02 Sep 2022 04:02:44 -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 74af7dcf38 * tp/t/converters_tests.t: warn file_* tests with output as 
text returned from the converter.  It is most probably wrong because the empty 
directories and files are compared instead of the test returned. Avoid files 
being overwritten with -o and warn.
74af7dcf38 is described below

commit 74af7dcf38b1e6fb36c3aa1a08ea74674e7d1527
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Sep 2 10:01:58 2022 +0200

    * tp/t/converters_tests.t: warn file_* tests with output as text returned
    from the converter.  It is most probably wrong because the empty
    directories and files are compared instead of the test returned.
    Avoid files being overwritten with -o and warn.
---
 ChangeLog                                   |   7 ++
 tp/t/09indices.t                            |   2 +-
 tp/t/16raw.t                                |   2 +-
 tp/t/converters_tests.t                     |   6 +-
 tp/t/results/indices/subentry_and_sortas.pl | 102 ----------------------------
 tp/t/results/raw/displaymath.pl             |   4 +-
 tp/t/test_utils.pl                          |  38 ++++++++---
 7 files changed, 45 insertions(+), 116 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 47f0705ffb..abe16d08b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-09-02  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/t/converters_tests.t: warn file_* tests with output as text 
returned
+       from the converter.  It is most probably wrong because the empty
+       directories and files are compared instead of the test returned.
+       Avoid files being overwritten with -o and warn.
+
 2022-09-01  Patrice Dumas  <pertusus@free.fr>
 
        Replace empty_line_after_command by block command extra 
spaces_after_argument
diff --git a/tp/t/09indices.t b/tp/t/09indices.t
index d71e26c528..29b2b1d371 100644
--- a/tp/t/09indices.t
+++ b/tp/t/09indices.t
@@ -617,7 +617,7 @@ in a reuglar para @sortas{foo}. @code{inside another 
@sortas{command}}.
 
 @printindex cp
 @printindex fn
-', {'test_formats' => ['plaintext', 'docbook', 'html']}
+', {'test_formats' => ['docbook']}
 ],
 ['multiple_index_text_sortas_seeentry_seealso',
 '@node Top
diff --git a/tp/t/16raw.t b/tp/t/16raw.t
index 2b62180d85..6885603c5f 100644
--- a/tp/t/16raw.t
+++ b/tp/t/16raw.t
@@ -339,7 +339,7 @@ before
 @end displaymath
 after
 ',
-{'test_formats' => ['file_html', 'docbook']},
+{'test_formats' => ['html', 'docbook']},
 {'HTML_MATH' => 'mathjax'}
 ],
 );
diff --git a/tp/t/converters_tests.t b/tp/t/converters_tests.t
index b19e45aac2..d42ebde3e0 100644
--- a/tp/t/converters_tests.t
+++ b/tp/t/converters_tests.t
@@ -1190,6 +1190,11 @@ foreach my $test (@test_cases) {
   } else {
     push @{$test->[2]->{'test_formats'}}, 'html_text';
   }
+  # could even be done for every test
+  if ($file_html_tests{$test->[0]}
+      or $file_latex_tests{$test->[0]}) {
+    $test->[2]->{'test_input_file_name'} = $test->[0] . '.texi';
+  }
   if ($file_html_tests{$test->[0]}) {
     push @{$test->[2]->{'test_formats'}}, 'file_html';
   }
@@ -1200,7 +1205,6 @@ foreach my $test (@test_cases) {
     push @{$test->[2]->{'test_formats'}}, 'docbook';
   }
   if ($file_latex_tests{$test->[0]}) {
-    $test->[2]->{'test_input_file_name'} = $test->[0] . '.texi';
     $test->[2]->{'full_document'} = 1
         unless (exists($test->[2]->{'full_document'}));
     push @{$test->[2]->{'test_formats'}}, 'file_latex';
diff --git a/tp/t/results/indices/subentry_and_sortas.pl 
b/tp/t/results/indices/subentry_and_sortas.pl
index bb654d5794..86d9d65458 100644
--- a/tp/t/results/indices/subentry_and_sortas.pl
+++ b/tp/t/results/indices/subentry_and_sortas.pl
@@ -695,20 +695,6 @@ $result_indices_sort_strings{'subentry_and_sortas'} = {
 
 
 
-$result_converted{'plaintext'}->{'subentry_and_sortas'} = '1 Index
-*******
-
-* Menu:
-
-* aaa, bbb:                              chapter index.         (line 3)
-
-* Menu:
-
-* xxx, zzz:                              chapter index.         (line 3)
-
-';
-
-
 $result_converted{'docbook'}->{'subentry_and_sortas'} = '<chapter label="1" 
id="chapter-index">
 <title>Index</title>
 
@@ -720,94 +706,6 @@ $result_converted{'docbook'}->{'subentry_and_sortas'} = 
'<chapter label="1" id="
 ';
 
 
-$result_converted{'html'}->{'subentry_and_sortas'} = '<!DOCTYPE html>
-<html>
-<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>Untitled Document</title>
-
-<meta name="description" content="Untitled Document">
-<meta name="keywords" content="Untitled Document">
-<meta name="resource-type" content="document">
-<meta name="distribution" content="global">
-<meta name="viewport" content="width=device-width,initial-scale=1">
-
-<link href="#Top" rel="start" title="Top">
-<link href="#chapter-index" rel="index" title="chapter index">
-<style type="text/css">
-<!--
-a.summary-letter-printindex {text-decoration: none}
-td.printindex-index-entry {vertical-align: top}
-td.printindex-index-section {vertical-align: top}
-th.entries-header-printindex {text-align:left}
-th.sections-header-printindex {text-align:left}
--->
-</style>
-
-
-</head>
-
-<body lang="en">
-<div class="top-level-extent" id="Top">
-<div class="nav-panel">
-<p>
-Next: <a href="#chapter-index" accesskey="n" rel="next">Index</a> &nbsp; [<a 
href="#chapter-index" title="Index" rel="index">Index</a>]</p>
-</div>
-<a class="top" id="SEC_Top"></a>
-<ul class="mini-toc">
-<li><a href="#chapter-index" accesskey="1">Index</a></li>
-</ul>
-<hr>
-<div class="chapter-level-extent" id="chapter-index">
-<div class="nav-panel">
-<p>
- &nbsp; [<a href="#chapter-index" title="Index" rel="index">Index</a>]</p>
-</div>
-<h2 class="chapter" id="Index">1 Index</h2>
-
-<a class="index-entry-id" id="index-aaa"></a>
-
-<a class="index-entry-id" id="index-xxx"></a>
-
-<div class="printindex cp-printindex">
-<table class="cp-entries-printindex" border="0">
-<tr><td></td><th class="entries-header-printindex">Index 
Entry</th><td>&nbsp;</td><th class="sections-header-printindex"> 
Section</th></tr>
-<tr><td colspan="4"> <hr></td></tr>
-<tr><th id="chapter-index_cp_letter-A">A</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa">aaa, 
bbb</a>:</td><td>&nbsp;</td><td class="printindex-index-section"><a 
href="#chapter-index">chapter index</a></td></tr>
-<tr><td colspan="4"> <hr></td></tr>
-</table>
-</div>
-<div class="printindex fn-printindex">
-<table class="fn-entries-printindex" border="0">
-<tr><td></td><th class="entries-header-printindex">Index 
Entry</th><td>&nbsp;</td><th class="sections-header-printindex"> 
Section</th></tr>
-<tr><td colspan="4"> <hr></td></tr>
-<tr><th id="chapter-index_fn_letter-X">X</th><td></td><td></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a 
href="#index-xxx"><code>xxx, zzz</code></a>:</td><td>&nbsp;</td><td 
class="printindex-index-section"><a href="#chapter-index">chapter 
index</a></td></tr>
-<tr><td colspan="4"> <hr></td></tr>
-</table>
-</div>
-</div>
-</div>
-
-
-
-</body>
-</html>
-';
-
-$result_converted_errors{'html'}->{'subentry_and_sortas'} = [
-  {
-    'error_line' => 'warning: must specify a title with a title command or @top
-',
-    'text' => 'must specify a title with a title command or @top',
-    'type' => 'warning'
-  }
-];
-
-
-
 $result_converted{'info'}->{'subentry_and_sortas'} = 'This is , produced from .
 
 
diff --git a/tp/t/results/raw/displaymath.pl b/tp/t/results/raw/displaymath.pl
index aae9cae6e0..8d418ab3e3 100644
--- a/tp/t/results/raw/displaymath.pl
+++ b/tp/t/results/raw/displaymath.pl
@@ -299,7 +299,7 @@ $result_floats{'displaymath'} = {};
 
 
 
-$result_converted{'file_html'}->{'displaymath'} = '<!DOCTYPE html>
+$result_converted{'html'}->{'displaymath'} = '<!DOCTYPE html>
 <html>
 <!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
 <head>
@@ -339,7 +339,7 @@ MathJax = {
 </html>
 ';
 
-$result_converted_errors{'file_html'}->{'displaymath'} = [
+$result_converted_errors{'html'}->{'displaymath'} = [
   {
     'error_line' => 'warning: must specify a title with a title command or @top
 ',
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index facada228a..d297bc5377 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1125,6 +1125,17 @@ sub test($$)
                                   $format_converter_options);
       $converted_errors{$format} = undef if (!@{$converted_errors{$format}});
 
+      if ($format =~ /^file_/ and defined ($converted{$format})) {
+        # This is certainly wrong, because the differences are made on
+        # the output files which should be empty.  Differences in output
+        # will be missed.  It is tempting to use such format to have
+        # output() called by the converter and get the file headers and
+        # footers output in the main test perl file, but it is incorrect.
+        # It is better to do as for the html or latex cases, have a _text
+        # format, like html_text for which convert() is called and have
+        # output() be called for the main format name, for example html.
+        warn "ERROR: $self->{'name'}: $test_name: $format: file test with 
result as text\n";
+      }
       # output converted result and errors in files if $arg_output is set
       if ($arg_output) {
         mkdir ("$output_files_dir/$self->{'name'}")
@@ -1137,22 +1148,31 @@ sub test($$)
         }
 
         if (defined ($converted{$format})) {
-          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;
+          my $original_test_outfile = "$self->{'name'}/$test_name.$extension";
+          my $test_outfile = $original_test_outfile;
+          if ($output_files{$original_test_outfile}) {
+            warn "WARNING: $self->{'name'}: $test_name: $format: same name: 
$original_test_outfile "
+                     ."(".join("|", 
@{$output_files{$original_test_outfile}}).")\n";
+            push @{$output_files{$original_test_outfile}}, $format;
+            $test_outfile = 
"$self->{'name'}/${test_name}_${format}.$extension";
+            # we also check that the file name with the format in name
+            # has not already been output
+            if ($output_files{$test_outfile}) {
+              warn "ERROR: $self->{'name'}: $test_name: $format: same name 
with format: $test_outfile\n";
+            } else {
+              $output_files{$test_outfile} = [$format];
+            }
           } else {
-            $output_files{$test_outfile} = [$format];
+            $output_files{$original_test_outfile} = [$format];
           }
+          my $outfile = "$output_files_dir/$test_outfile";
           if (!open (OUTFILE, ">$outfile")) {
-            warn "Open $outfile: $!\n";
+            warn "ERROR: open $outfile: $!\n";
           } else {
             my $output_file_encoding;
             # FIXME do all the converters implement get_conf?  Otherwise
             # the OUTPUT_PERL_ENCODING could ve determined from
-            # $format_converter_options->{'OUTPUT_ENCODING_NAME'} useing the
+            # $format_converter_options->{'OUTPUT_ENCODING_NAME'} using the
             # same code as in Texinfo/Common.pm set_output_encodings
             my $output_perl_encoding = 
$converter->get_conf('OUTPUT_PERL_ENCODING');
             if (defined($output_perl_encoding)) {



reply via email to

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