texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Improve test results optional output files


From: Patrice Dumas
Subject: branch master updated: Improve test results optional output files
Date: Thu, 14 Apr 2022 08:00:48 -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 12a3f26555 Improve test results optional output files
12a3f26555 is described below

commit 12a3f26555853adde63f75785a26ad0d785658f8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Apr 14 13:56:37 2022 +0200

    Improve test results optional output files
    
    * tp/Texinfo/Convert/HTML.pm (css_get_info): handle undef
    'css_rule_lines' and 'css_import_lines'.
    
    * tp/t/test_utils.pl: dynamic CSS in HTML preamble.  Other
    cleanups.
---
 ChangeLog                  |  10 +++
 tp/Texinfo/Convert/HTML.pm |  12 ++-
 tp/t/02coverage.t          |   5 +-
 tp/t/03coverage_braces.t   |   7 +-
 tp/t/04verb.t              |   6 +-
 tp/t/05paragraph.t         |   5 +-
 tp/t/06columnfractions.t   |  30 +------
 tp/t/08misc_commands.t     |   6 +-
 tp/t/09indices.t           |   6 +-
 tp/t/10menu.t              |   5 +-
 tp/t/16raw.t               |   6 +-
 tp/t/181quotation.t        |   6 +-
 tp/t/18itemize.t           |   6 +-
 tp/t/19def.t               |   6 +-
 tp/t/20preformatted.t      |   5 +-
 tp/t/21multitable.t        |   6 +-
 tp/t/22xtable.t            |   6 +-
 tp/t/25regions.t           |   6 +-
 tp/t/27float.t             |   6 +-
 tp/t/28heading.t           |   6 +-
 tp/t/30sectioning.t        |   8 +-
 tp/t/50value.t             |   6 +-
 tp/t/55conditionals.t      |   6 +-
 tp/t/57invalid_nestings.t  |   6 +-
 tp/t/58alias.t             |   6 +-
 tp/t/60macro.t             |   6 +-
 tp/t/70value_and_macro.t   |   6 +-
 tp/t/80include.t           |   6 +-
 tp/t/91morecoverage.t      |   5 +-
 tp/t/92formatting.t        |   5 +-
 tp/t/93layout.t            |   4 +-
 tp/t/94htmlxref.t          |   2 +-
 tp/t/95moreindices.t       |   4 +-
 tp/t/96moresectioning.t    |   4 +-
 tp/t/converters_tests.t    |   7 +-
 tp/t/docbook_tests.t       |   8 +-
 tp/t/formats_encodings.t   |   7 +-
 tp/t/html_tests.t          |  10 +--
 tp/t/info_tests.t          |   8 +-
 tp/t/init_files_tests.t    |   8 +-
 tp/t/languages.t           |   7 +-
 tp/t/latex_tests.t         |   7 +-
 tp/t/plaintext_tests.t     |   7 +-
 tp/t/test_utils.pl         | 191 +++++++++++++++++++++------------------------
 tp/t/xml_tests.t           |   8 +-
 45 files changed, 155 insertions(+), 338 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eabd80e244..0e209b45e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-04-14  Patrice Dumas  <pertusus@free.fr>
+
+       Improve test results optional output files
+
+       * tp/Texinfo/Convert/HTML.pm (css_get_info): handle undef
+       'css_rule_lines' and 'css_import_lines'.
+
+       * tp/t/test_utils.pl: dynamic CSS in HTML preamble.  Other
+       cleanups.
+
 2022-04-14  Gavin Smith  <gavinsmith0123@gmail.com>
 
        Avoid divergent test results due to wcwidth
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 4895957cfc..457848dbd6 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -326,9 +326,17 @@ sub css_get_info($$;$) {
   my $css_info = shift;
 
   if ($spec eq 'rules') {
-    return @{$self->{'css_rule_lines'}};
+    if (defined($self->{'css_rule_lines'})) {
+      return @{$self->{'css_rule_lines'}};
+    } else {
+      return ();
+    }
   } elsif ($spec eq 'imports') {
-    return @{$self->{'css_import_lines'}};
+    if (defined($self->{'css_import_lines'})) {
+      return @{$self->{'css_import_lines'}};
+    } else {
+      return ();
+    }
   } else {
     if (defined($css_info)) {
       if ($self->{'css_element_class_styles'}->{$css_info}) {
diff --git a/tp/t/02coverage.t b/tp/t/02coverage.t
index 4d436adba2..40d7ebcde7 100644
--- a/tp/t/02coverage.t
+++ b/tp/t/02coverage.t
@@ -850,7 +850,4 @@ foreach my $test (@test_cases) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('coverage', [@test_cases, @test_tree], $arg_test_case,
-   $arg_generate, $arg_debug);
+run_all('coverage', [@test_cases, @test_tree]);
diff --git a/tp/t/03coverage_braces.t b/tp/t/03coverage_braces.t
index e5449cd362..7a80ea6f9a 100644
--- a/tp/t/03coverage_braces.t
+++ b/tp/t/03coverage_braces.t
@@ -344,9 +344,4 @@ foreach my $test (@test_cases) {
     if (grep {$_ eq $test->[0]} @latex_tests_cases_tests);
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('coverage_braces', [@test_cases, @test_invalid], $arg_test_case,
-   $arg_generate, $arg_debug);
-
-1;
+run_all('coverage_braces', [@test_cases, @test_invalid]);
diff --git a/tp/t/04verb.t b/tp/t/04verb.t
index cc2165a5d9..d28e429a97 100644
--- a/tp/t/04verb.t
+++ b/tp/t/04verb.t
@@ -38,8 +38,4 @@ In verb
 '],
 );
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('verb', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('verb', \@test_cases);
diff --git a/tp/t/05paragraph.t b/tp/t/05paragraph.t
index 239bc67f3f..8b4ee63b21 100644
--- a/tp/t/05paragraph.t
+++ b/tp/t/05paragraph.t
@@ -172,7 +172,4 @@ foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, 'html_text';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('paragraph', [@test_cases, @test_invalid], $arg_test_case, 
-   $arg_generate, $arg_debug);
+run_all('paragraph', [@test_cases, @test_invalid]);
diff --git a/tp/t/06columnfractions.t b/tp/t/06columnfractions.t
index 10a70ff8e9..0d3dc18208 100644
--- a/tp/t/06columnfractions.t
+++ b/tp/t/06columnfractions.t
@@ -1,4 +1,3 @@
-use Test::More;
 use strict;
 
 use lib '.';
@@ -28,31 +27,4 @@ my @test_cases = (
 @end multitable' ]
 );
 
-our $arg_generate;
-our $arg_complete;
-our $arg_test_case;
-our $arg_debug;
-our $nr_comparisons;
-
-ok(1);
-
-my $test = new_test('columnfractions', $arg_generate, $arg_debug);
-
-my @done_tests;
-
-foreach my $test_case (@test_cases) {
-  next if ($arg_test_case and $arg_test_case ne $test_case->[0]);
-  if ($arg_complete) {
-    $test->output_texi_file($test_case);
-  } else {
-    $test->test($test_case);
-    push @done_tests, $test_case;
-  }
-}
-
-if ($arg_generate or $arg_complete) {
-  plan tests => 2;
-}
-else {
-  plan tests => (2 + scalar(@done_tests) * $nr_comparisons);
-}
+run_all('columnfractions', [@test_cases]);
diff --git a/tp/t/08misc_commands.t b/tp/t/08misc_commands.t
index 122471e666..3339597a39 100644
--- a/tp/t/08misc_commands.t
+++ b/tp/t/08misc_commands.t
@@ -591,8 +591,4 @@ foreach my $test (@converted_test_cases) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('misc_commands', [@test_cases, @converted_test_cases], $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('misc_commands', [@test_cases, @converted_test_cases]);
diff --git a/tp/t/09indices.t b/tp/t/09indices.t
index 6d659829fb..e739603a87 100644
--- a/tp/t/09indices.t
+++ b/tp/t/09indices.t
@@ -753,8 +753,4 @@ foreach my $test (@file_tests) {
   push @{$test->[2]->{'test_formats'}}, 'file_info';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('indices', [@test_cases, @test_formatted, @file_tests], 
-   $arg_test_case, $arg_generate, $arg_debug);
-
+run_all('indices', [@test_cases, @test_formatted, @file_tests]);
diff --git a/tp/t/10menu.t b/tp/t/10menu.t
index bd9bf45342..b19a61db5f 100644
--- a/tp/t/10menu.t
+++ b/tp/t/10menu.t
@@ -525,7 +525,4 @@ foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, 'xml';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('menu', [@test_cases, @test_invalid], $arg_test_case,
-   $arg_generate, $arg_debug);
+run_all('menu', [@test_cases, @test_invalid]);
diff --git a/tp/t/16raw.t b/tp/t/16raw.t
index a72e604ae7..a4f68edfa9 100644
--- a/tp/t/16raw.t
+++ b/tp/t/16raw.t
@@ -408,8 +408,4 @@ foreach my $test (@test_cases) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('raw', [@test_cases, @test_invalid], $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('raw', [@test_cases, @test_invalid]);
diff --git a/tp/t/181quotation.t b/tp/t/181quotation.t
index e8107b1bc0..58bbc970d7 100644
--- a/tp/t/181quotation.t
+++ b/tp/t/181quotation.t
@@ -118,8 +118,4 @@ foreach my $test (@test_cases) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('quotation', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('quotation', \@test_cases);
diff --git a/tp/t/18itemize.t b/tp/t/18itemize.t
index 9085c744ba..60738cb583 100644
--- a/tp/t/18itemize.t
+++ b/tp/t/18itemize.t
@@ -633,8 +633,4 @@ foreach my $test (@test_full_doc) {
   $test->[2]->{'full_document'} = 1 unless 
(exists($test->[2]->{'full_document'}));
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('itemize', [@test_cases, @test_full_doc, @test_invalid], 
$arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('itemize', [@test_cases, @test_full_doc, @test_invalid]);
diff --git a/tp/t/19def.t b/tp/t/19def.t
index b91458277b..9c0568f3fb 100644
--- a/tp/t/19def.t
+++ b/tp/t/19def.t
@@ -590,8 +590,4 @@ foreach my $test (@test_info) {
   $test->[2]->{'test_formats'} = ['info', 'html'];
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('def', [@test_cases, @test_info, @test_invalid, @test_printindex], 
$arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('def', [@test_cases, @test_info, @test_invalid, @test_printindex]);
diff --git a/tp/t/20preformatted.t b/tp/t/20preformatted.t
index 15f2cc3d04..2d82a0f278 100644
--- a/tp/t/20preformatted.t
+++ b/tp/t/20preformatted.t
@@ -203,8 +203,5 @@ foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, 'xml';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('preformatted', [@test_cases, @test_invalid], $arg_test_case,
-   $arg_generate, $arg_debug);
+run_all('preformatted', [@test_cases, @test_invalid]);
 
diff --git a/tp/t/21multitable.t b/tp/t/21multitable.t
index dd8d4a8dbf..59ab782306 100644
--- a/tp/t/21multitable.t
+++ b/tp/t/21multitable.t
@@ -211,8 +211,4 @@ foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, 'xml';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('multitable', [@test_cases, @test_invalid], $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('multitable', [@test_cases, @test_invalid]);
diff --git a/tp/t/22xtable.t b/tp/t/22xtable.t
index ea352962ab..e50f4c22db 100644
--- a/tp/t/22xtable.t
+++ b/tp/t/22xtable.t
@@ -329,8 +329,4 @@ foreach my $test (@test_cases) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('xtable', [@test_cases, @test_invalid], $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('xtable', [@test_cases, @test_invalid]);
diff --git a/tp/t/25regions.t b/tp/t/25regions.t
index bcb78c61ae..ee58ad44e1 100644
--- a/tp/t/25regions.t
+++ b/tp/t/25regions.t
@@ -142,8 +142,4 @@ foreach my $test (@test_formatted) {
   push @{$test->[2]->{'test_formats'}}, 'html';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('regions', [@test_cases, @test_formatted], $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('regions', [@test_cases, @test_formatted]);
diff --git a/tp/t/27float.t b/tp/t/27float.t
index 3757933d9c..cd19b2996d 100644
--- a/tp/t/27float.t
+++ b/tp/t/27float.t
@@ -541,8 +541,4 @@ foreach my $test (@test_cases) {
   $test->[2]->{'full_document'} = 1 unless 
(exists($test->[2]->{'full_document'}));
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('float', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('float', \@test_cases);
diff --git a/tp/t/28heading.t b/tp/t/28heading.t
index 792c2aa9ad..551074425d 100644
--- a/tp/t/28heading.t
+++ b/tp/t/28heading.t
@@ -33,12 +33,8 @@ my @test_cases = (
 ']
 );
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
 foreach my $test (@test_cases) {
   $test->[2]->{'test_formats'} = ['plaintext', 'html'];
 }
 
-run_all ('heading', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('heading', \@test_cases);
diff --git a/tp/t/30sectioning.t b/tp/t/30sectioning.t
index bc7ac6cd3f..562ab3fbba 100644
--- a/tp/t/30sectioning.t
+++ b/tp/t/30sectioning.t
@@ -2175,9 +2175,5 @@ foreach my $test (@test_cases) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('sectioning', [@test_cases, @tests_converted,
-                        @test_out_files, @tests_info], $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('sectioning', [@test_cases, @tests_converted,
+                       @test_out_files, @tests_info]);
diff --git a/tp/t/50value.t b/tp/t/50value.t
index b9a4eeb447..243fd1df9a 100644
--- a/tp/t/50value.t
+++ b/tp/t/50value.t
@@ -351,8 +351,4 @@ line
 ']
 );
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('value', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('value', \@test_cases);
diff --git a/tp/t/55conditionals.t b/tp/t/55conditionals.t
index 5203becc8b..7e9062c4dc 100644
--- a/tp/t/55conditionals.t
+++ b/tp/t/55conditionals.t
@@ -503,8 +503,4 @@ for my $test (@test_cases) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('conditionals', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('conditionals', \@test_cases);
diff --git a/tp/t/57invalid_nestings.t b/tp/t/57invalid_nestings.t
index 11ef21a3dc..bc24919ac4 100644
--- a/tp/t/57invalid_nestings.t
+++ b/tp/t/57invalid_nestings.t
@@ -566,8 +566,4 @@ foreach my $test (@formatted_cases) {
   $test->[2]->{'test_formats'} = ['plaintext'];
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('invalid_nestings', [@test_cases, @formatted_cases], $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('invalid_nestings', [@test_cases, @formatted_cases]);
diff --git a/tp/t/58alias.t b/tp/t/58alias.t
index 24dc5c37c2..7e328fb08c 100644
--- a/tp/t/58alias.t
+++ b/tp/t/58alias.t
@@ -37,8 +37,4 @@ in lang
 '],
 );
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('alias', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('alias', \@test_cases);
diff --git a/tp/t/60macro.t b/tp/t/60macro.t
index e37df1c03f..96e9ac8487 100644
--- a/tp/t/60macro.t
+++ b/tp/t/60macro.t
@@ -1051,8 +1051,4 @@ The @gentry{id1, name1, text1\, arg1 } is used in many 
cases while
 );
 
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('macro', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('macro', \@test_cases);
diff --git a/tp/t/70value_and_macro.t b/tp/t/70value_and_macro.t
index aa985596b1..6b14fcf9ac 100644
--- a/tp/t/70value_and_macro.t
+++ b/tp/t/70value_and_macro.t
@@ -47,8 +47,4 @@ result: @emph{\\arg\\} the \\the\\ thearg \\thearg\\ with 
value \\the@value{argu
 );
 
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('value_and_macro', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('value_and_macro', \@test_cases);
diff --git a/tp/t/80include.t b/tp/t/80include.t
index 8458203416..4b997e5cee 100644
--- a/tp/t/80include.t
+++ b/tp/t/80include.t
@@ -157,8 +157,4 @@ undef, {'test_file' => 'cpp_line_latin1.texi'},
 ],
 );
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('include', \@test_cases, $arg_test_case,
-   $arg_generate, $arg_debug);
-
+run_all('include', \@test_cases);
diff --git a/tp/t/91morecoverage.t b/tp/t/91morecoverage.t
index f208364ee7..93bbc04b91 100644
--- a/tp/t/91morecoverage.t
+++ b/tp/t/91morecoverage.t
@@ -26,7 +26,4 @@ foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, ('info', 'html', 'html_text');
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('morecoverage', [@test_cases], $arg_test_case,
-   $arg_generate, $arg_debug);
+run_all('morecoverage', [@test_cases]);
diff --git a/tp/t/92formatting.t b/tp/t/92formatting.t
index a7340abbe1..f7b3a17d88 100644
--- a/tp/t/92formatting.t
+++ b/tp/t/92formatting.t
@@ -169,7 +169,4 @@ foreach my $test (@test_cases) {
   $test->[3]->{'PROGRAM'} = 'texi2any';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('formatting', [@test_cases], $arg_test_case,
-   $arg_generate, $arg_debug);
+run_all('formatting', [@test_cases]);
diff --git a/tp/t/93layout.t b/tp/t/93layout.t
index 1800f8d67a..3e46771b0d 100644
--- a/tp/t/93layout.t
+++ b/tp/t/93layout.t
@@ -96,6 +96,4 @@ foreach my $test (@test_cases) {
   $test->[3]->{'PACKAGE_URL'} = 'http://www.gnu.org/software/texinfo/';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('layout', [@test_cases], $arg_test_case, $arg_generate, $arg_debug);
+run_all('layout', [@test_cases]);
diff --git a/tp/t/94htmlxref.t b/tp/t/94htmlxref.t
index 2d3e8a3655..bd64a30152 100644
--- a/tp/t/94htmlxref.t
+++ b/tp/t/94htmlxref.t
@@ -54,4 +54,4 @@ foreach my $test (@test_cases) {
 
 our ($arg_test_case, $arg_generate, $arg_debug);
 
-run_all ('htmlxref', [@test_cases], $arg_test_case, $arg_generate, $arg_debug);
+run_all('htmlxref', [@test_cases]);
diff --git a/tp/t/95moreindices.t b/tp/t/95moreindices.t
index a4a432a4cf..50f07315c2 100644
--- a/tp/t/95moreindices.t
+++ b/tp/t/95moreindices.t
@@ -68,6 +68,4 @@ foreach my $test (@test_cases) {
   $test->[3]->{'PACKAGE_URL'} = 'http://www.gnu.org/software/texinfo/';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('moreindices', [@test_cases], $arg_test_case, $arg_generate, 
$arg_debug);
+run_all('moreindices', [@test_cases]);
diff --git a/tp/t/96moresectioning.t b/tp/t/96moresectioning.t
index 02dd33785a..0a42fd33e3 100644
--- a/tp/t/96moresectioning.t
+++ b/tp/t/96moresectioning.t
@@ -113,6 +113,4 @@ foreach my $test (@test_cases) {
   $test->[3]->{'PACKAGE_URL'} = 'http://www.gnu.org/software/texinfo/';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('moresectioning', [@test_cases], $arg_test_case, $arg_generate, 
$arg_debug);
+run_all('moresectioning', [@test_cases]);
diff --git a/tp/t/converters_tests.t b/tp/t/converters_tests.t
index 14e946b4df..bb5bbc7c96 100644
--- a/tp/t/converters_tests.t
+++ b/tp/t/converters_tests.t
@@ -872,9 +872,4 @@ foreach my $test (@file_tests) {
   push @{$test->[2]->{'test_formats'}}, ('file_xml', 'file_docbook', 
'file_latex');
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-run_all ('converters_tests', [@test_cases, @html_text_cases, @file_tests],
-   $arg_test_case, $arg_generate, $arg_debug);
-
-1;
-
+run_all('converters_tests', [@test_cases, @html_text_cases, @file_tests]);
diff --git a/tp/t/docbook_tests.t b/tp/t/docbook_tests.t
index 71244bd19f..b3498b28df 100644
--- a/tp/t/docbook_tests.t
+++ b/tp/t/docbook_tests.t
@@ -88,10 +88,4 @@ foreach my $test (@test_cases) {
   $test->[2]->{'test_formats'} = ['docbook'];
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('docbook_tests', [@test_cases], $arg_test_case,
-   $arg_generate, $arg_debug);
-
-1;
-
+run_all('docbook_tests', [@test_cases]);
diff --git a/tp/t/formats_encodings.t b/tp/t/formats_encodings.t
index dfaaf9fcd0..3e85f1efcd 100644
--- a/tp/t/formats_encodings.t
+++ b/tp/t/formats_encodings.t
@@ -439,8 +439,5 @@ foreach my $test (@file_tests) {
   }
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-run_all ('formats_encodings', [@test_cases, @test_full_doc, @file_tests, 
@html_text_cases],
-   $arg_test_case, $arg_generate, $arg_debug);
-
-1;
+run_all('formats_encodings', [@test_cases, @test_full_doc, 
+                              @file_tests, @html_text_cases]);
diff --git a/tp/t/html_tests.t b/tp/t/html_tests.t
index 64eae8f9ed..2774f71ab2 100644
--- a/tp/t/html_tests.t
+++ b/tp/t/html_tests.t
@@ -744,11 +744,5 @@ foreach my $test (@test_cases_file_text) {
   push @{$test->[2]->{'test_formats'}}, ('html_text', 'file_html');
 }
 
-
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('html_tests', [@test_cases, @test_cases_text, @test_cases_file_text,
-                        @file_tests], $arg_test_case, $arg_generate, 
$arg_debug);
-
-1;
-
+run_all('html_tests', [@test_cases, @test_cases_text,
+                       @test_cases_file_text, @file_tests]);
diff --git a/tp/t/info_tests.t b/tp/t/info_tests.t
index 5bf584a6f4..7c16d39422 100644
--- a/tp/t/info_tests.t
+++ b/tp/t/info_tests.t
@@ -982,10 +982,4 @@ foreach my $test (@file_tests) {
   push @{$test->[2]->{'test_formats'}}, 'file_info';
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('info_tests', [@test_cases, @file_tests], $arg_test_case,
-   $arg_generate, $arg_debug);
-
-1;
-
+run_all('info_tests', [@test_cases, @file_tests]);
diff --git a/tp/t/init_files_tests.t b/tp/t/init_files_tests.t
index eb3b4196de..3bb126019e 100644
--- a/tp/t/init_files_tests.t
+++ b/tp/t/init_files_tests.t
@@ -30,14 +30,8 @@ pt @error{}.
 }],
 );
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
 foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, 'html';
 }
 
-run_all ('init_files_tests', [@test_cases], $arg_test_case,
-   $arg_generate, $arg_debug);
-
-1;
-
+run_all('init_files_tests', [@test_cases]);
diff --git a/tp/t/languages.t b/tp/t/languages.t
index 9c71741f6a..fff3180e9c 100644
--- a/tp/t/languages.t
+++ b/tp/t/languages.t
@@ -272,9 +272,4 @@ foreach my $test (@latex_file_tests) {
   $test->[2]->{'full_document'} = 1 unless 
(exists($test->[2]->{'full_document'}));
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('languages', [@test_cases, @file_tests, @latex_file_tests], 
-   $arg_test_case, $arg_generate, $arg_debug);
-
-1;
+run_all('languages', [@test_cases, @file_tests, @latex_file_tests]);
diff --git a/tp/t/latex_tests.t b/tp/t/latex_tests.t
index dbe1ec454a..bcf58efc8e 100644
--- a/tp/t/latex_tests.t
+++ b/tp/t/latex_tests.t
@@ -644,9 +644,4 @@ foreach my $test (@file_tests) {
   $test->[2]->{'full_document'} = 1 unless 
(exists($test->[2]->{'full_document'}));
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('latex_tests', [@test_cases, @file_tests], $arg_test_case,
-   $arg_generate, $arg_debug);
-
-1;
+run_all('latex_tests', [@test_cases, @file_tests]);
diff --git a/tp/t/plaintext_tests.t b/tp/t/plaintext_tests.t
index 69b872da80..467e5b1f25 100644
--- a/tp/t/plaintext_tests.t
+++ b/tp/t/plaintext_tests.t
@@ -1028,9 +1028,4 @@ foreach my $test (@file_tests) {
   $test->[2]->{'test_formats'} = ['file_plaintext'];
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('plaintext_tests', [@test_cases, @file_tests], $arg_test_case,
-   $arg_generate, $arg_debug);
-
-1;
+run_all('plaintext_tests', [@test_cases, @file_tests]);
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 34d63c4874..ea64137a2c 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -42,18 +42,19 @@ use Test::More;
 # to determine the locale encoding to output the Texinfo to Texinfo
 # result when regenerating
 use I18N::Langinfo qw(langinfo CODESET);
-use Encode;
-use File::Basename;
-use File::Copy;
-use File::Compare; # standard since 5.004
-use Data::Dumper;
-use Data::Compare;
-use Test::Deep;
+use Encode ();
+#use File::Basename;
+#use File::Copy;
+use File::Compare qw(compare); # standard since 5.004
+use Data::Dumper ();
+use Data::Compare ();
+use Test::Deep ();
 use Storable qw(dclone); # standard in 5.007003
 #use Data::Diff;
 #use Data::Transformer;
 #use Struct::Compare;
 use Getopt::Long qw(GetOptions);
+use Locale::Messages ();
 
 use Texinfo::Common;
 use Texinfo::Convert::Texinfo;
@@ -68,14 +69,15 @@ use Texinfo::Convert::HTML;
 use Texinfo::Convert::TexinfoXML;
 use Texinfo::Convert::DocBook;
 
-# FIXME Is it really useful?
+# the tests reference perl results file is loaded through a require
+# with those variables.
 use vars qw(%result_texis %result_texts %result_trees %result_errors
    %result_indices %result_sectioning %result_nodes %result_menus
    %result_floats %result_converted %result_converted_errors
    %result_elements %result_directions_text %result_indices_sort_strings);
 
 my $strings_textdomain = 'texinfo_document';
-Locale::Messages->select_package ('gettext_pp');
+Locale::Messages->select_package('gettext_pp');
 
 my $srcdir = $ENV{'srcdir'};
 my $locales_srcdir;
@@ -98,14 +100,14 @@ if (! defined($localesdir)) {
   warn "No locales directory found, some tests will fail\n";
 }
 
-Locale::Messages::bindtextdomain ('texinfo_document', $localesdir);
-Locale::Messages::bindtextdomain ('texinfo', $localesdir);
+Locale::Messages::bindtextdomain('texinfo_document', $localesdir);
+Locale::Messages::bindtextdomain('texinfo', $localesdir);
 
 my $generated_texis_dir = 't_texis';
 
 my $input_files_dir = $srcdir."t/input_files/";
 
-our $output_files_dir = 't/output_files/';
+my $output_files_dir = 't/output_files/';
 foreach my $dir ('t', 't/results', $output_files_dir) {
   my $error;
   # to avoid a race conditon, first create the dir then test that it
@@ -121,7 +123,7 @@ $locale_encoding = undef if ($locale_encoding eq '');
 
 ok(1);
 
-our %formats = (
+my %formats = (
   'plaintext' => \&convert_to_plaintext,
   'file_plaintext' => \&convert_to_plaintext,
   'info' => \&convert_to_info,
@@ -138,7 +140,7 @@ our %formats = (
   'file_latex' => \&convert_to_latex,
 );
 
-our %extensions = (
+my %extensions = (
   'plaintext' => 'txt',
   'html_text' => 'html',
   'xml' => 'xml',
@@ -162,49 +164,9 @@ my %outfile_preamble = (
 '."<!DOCTYPE texinfo PUBLIC \"-//GNU//DTD TexinfoML V${XML_DTD_VERSION}//EN\" 
\"http://www.gnu.org/software/texinfo/dtd/${XML_DTD_VERSION}/texinfo.dtd\";>
 ".'<texinfo xml:lang="en">
 ', "</texinfo>\n"],
- 'html_text' => ['<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd";>
-<html>
-<head>
-<title>Untitled Document</title>
-<meta name="resource-type" content="document">
-<meta name="distribution" content="global">
-<meta name="Generator" content="tp">
-<style type="text/css">
-<!--
-a.summary-letter {text-decoration: none}
-blockquote.indentedblock {margin-right: 0em}
-blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
-blockquote.smallquotation {font-size: smaller}
-div.display {margin-left: 3.2em}
-div.example {margin-left: 3.2em}
-div.lisp {margin-left: 3.2em}
-div.smalldisplay {margin-left: 3.2em}
-div.smallexample {margin-left: 3.2em}
-div.smalllisp {margin-left: 3.2em}
-kbd {font-style: oblique}
-pre.display {font-family: inherit}
-pre.format {font-family: inherit}
-pre.menu-comment {font-family: serif}
-pre.menu-preformatted {font-family: serif}
-pre.smalldisplay {font-family: inherit; font-size: smaller}
-pre.smallexample {font-size: smaller}
-pre.smallformat {font-family: inherit; font-size: smaller}
-pre.smalllisp {font-size: smaller}
-span.nocodebreak {white-space: nowrap}
-span.nolinebreak {white-space: nowrap}
-span.roman {font-family: serif; font-weight: normal}
-span.sansserif {font-family: sans-serif; font-weight: normal}
-ul.no-bullet {list-style: none}
--->
-</style>
-</head>
-
-<body>
-',
-'</body>
-</html>
-'],
-# FIXME complete
+ # done dynamically for CSS
+ 'html_text' => \&output_preamble_postamble_html,
+# FIXME do dynamically
  'latex' => ['\documentclass{book}
 \usepackage{makeidx}\makeindex
 \usepackage{amsfonts}
@@ -217,17 +179,18 @@ ul.no-bullet {list-style: none}
 ']
 );
 
-our $arg_generate;
-our $arg_debug;
-our $arg_complete;
-our $arg_output;
-our $nr_comparisons = 9;
+my $arg_generate;
+my $arg_debug;
+my $arg_complete;
+my $arg_output;
+my $nr_comparisons = 9;
 
 Getopt::Long::Configure("gnu_getopt");
+# complete: output a complete texinfo file based on the test
 GetOptions('g|generate' => \$arg_generate, 'd|debug=i' => \$arg_debug,
            'c|complete' => \$arg_complete, 'o|output' => \$arg_output);
 
-our $arg_test_case = shift @ARGV;
+my $arg_test_case = shift @ARGV;
 
 sub protect_perl_string($)
 {
@@ -498,7 +461,7 @@ my @sections_keys = ('section_next', 'section_prev', 
'section_up',
 my @node_keys = ('node_next', 'node_prev', 'node_up', 'menus',
   'associated_section', 'node_preceding_part');
 my %avoided_keys_tree;
-our @avoided_keys_tree = (@sections_keys, @menus_keys, @node_keys, 'structure',
+my @avoided_keys_tree = (@sections_keys, @menus_keys, @node_keys, 'structure',
    'menu_child', 'unit_next', 'directions', 'page_next', 'remaining_args');
 foreach my $avoided_key(@avoided_keys_tree) {
   $avoided_keys_tree{$avoided_key} = 1;
@@ -612,7 +575,7 @@ sub convert_to_plaintext($$$$$$;$)
     $result = undef if (defined($result) and ($result eq ''));
   }
   my ($errors, $error_nrs) = $converter->errors();
-  return ($errors, $result);
+  return ($errors, $result, $converter);
 }
 
 sub convert_to_info($$$$$;$)
@@ -638,7 +601,7 @@ sub convert_to_info($$$$$;$)
   close_files($converter);
   die if (!defined($converter_options->{'SUBDIR'}) and !defined($result));
   my ($errors, $error_nrs) = $converter->errors();
-  return ($errors, $result);
+  return ($errors, $result, $converter);
 }
 
 sub convert_to_html($$$$$$;$)
@@ -664,6 +627,8 @@ sub convert_to_html($$$$$$;$)
                                           %$converter_options });
   my $result;
   if ($format eq 'html_text') {
+    # this is needed for CSS rules output, in case $arg_output is set
+    $converter->{'current_filename'} = '';
     $result = $converter->convert($tree);
   } else {
     $result = $converter->output($tree);
@@ -671,7 +636,7 @@ sub convert_to_html($$$$$$;$)
   }
   die if (!defined($converter_options->{'SUBDIR'}) and !defined($result));
   my ($errors, $error_nrs) = $converter->errors();
-  return ($errors, $result);
+  return ($errors, $result, $converter);
 }
 
 sub convert_to_xml($$$$$$;$)
@@ -703,7 +668,7 @@ sub convert_to_xml($$$$$$;$)
     $result = undef if (defined($result) and ($result eq ''));
   }
   my ($errors, $error_nrs) = $converter->errors();
-  return ($errors, $result);
+  return ($errors, $result, $converter);
 }
 
 sub convert_to_docbook($$$$$$;$)
@@ -751,7 +716,7 @@ sub convert_to_docbook($$$$$$;$)
     $result = undef if (defined($result) and ($result eq ''));
   }
   my ($errors, $error_nrs) = $converter->errors();
-  return ($errors, $result);
+  return ($errors, $result, $converter);
 }
 
 sub convert_to_latex($$$$$$;$)
@@ -782,7 +747,33 @@ sub convert_to_latex($$$$$$;$)
     $result = undef if (defined($result) and ($result eq ''));
   }
   my ($errors, $error_nrs) = $converter->errors();
-  return ($errors, $result);
+  return ($errors, $result, $converter);
+}
+
+sub output_preamble_postamble_html($$)
+{
+  my $converter = shift;
+  my $postamble = shift;
+
+  if ($postamble) {
+    return '</body>
+</html>
+'
+  } else {
+    return '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+<head>
+<title>Untitled Document</title>
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="tp">
+'
+.&{$converter->formatting_function('format_css_lines')}($converter,
+                    $converter->{'current_filename'})
+.'</head>
+<body>
+';
+  }
 }
 
 # Run a single test case.  Each test case is an array
@@ -1080,7 +1071,8 @@ sub test($$)
       $format_converter_options->{'TEST'} = 1;
       $format_converter_options->{'INCLUDE_DIRECTORIES'} = [
                                           $srcdir.'t/include/'];
-      ($converted_errors{$format}, $converted{$format})
+      my $converter;
+      ($converted_errors{$format}, $converted{$format}, $converter)
            = &{$formats{$format}}($self, $test_name, $format_type,
                                   $result, $parser, $main_configuration,
                                   $format_converter_options);
@@ -1108,11 +1100,19 @@ sub test($$)
               binmode(OUTFILE, ":encoding($info->{'perl_encoding'})");
             }
             if ($outfile_preamble{$format}) {
-              print OUTFILE $outfile_preamble{$format}->[0];
+              if (ref($outfile_preamble{$format}) eq 'CODE') {
+                print OUTFILE &{$outfile_preamble{$format}}($converter, 0);
+              } else {
+                print OUTFILE $outfile_preamble{$format}->[0];
+              }
             }
             print OUTFILE $converted{$format};
             if ($outfile_preamble{$format}) {
-              print OUTFILE $outfile_preamble{$format}->[1];
+              if (ref($outfile_preamble{$format}) eq 'CODE') {
+                print OUTFILE &{$outfile_preamble{$format}}($converter, 1);
+              } else {
+                print OUTFILE $outfile_preamble{$format}->[1];
+              }
             }
             close (OUTFILE) or warn "Close $outfile: $!\n";
           }
@@ -1386,33 +1386,28 @@ sub test($$)
   return $tests_count;
 }
 
-# Main entry point for the tests.
+# Main entry point for the tests.  Called from *.t files.
 #  $NAME - a string, name of test
 #  $TEST_CASES - array of sub-tests
-#  If $TEST_CASE_NAME is given, only run that test.
-#  $GENERATE means to generate reference test results (-g from command line).
-#  $DEBUG for debugging.
-# The $ARG_COMPLETE variable is the -c option, to create Texinfo files for the
-# test cases.
-sub run_all($$;$$$)
+#
+# variables set from command line:
+#  If $ARG_TEST_CASE is set, only run that test.
+#  $ARG_GENERATE set means to generate reference test results (-g from command 
line).
+#  $ARG_DEBUG is used for debugging (-d from command line).
+#  The $ARG_COMPLETE variable is the -c option, to create Texinfo files for the
+#  test cases.
+sub run_all($$)
 {
   my $name = shift;
   my $test_cases = shift;
-  my $test_case_name = shift;
-  my $generate = shift;
-  my $debug = shift;
 
-  my $test = new_test($name, $generate, $debug);
+  my $test = new_test($name, $arg_generate, $arg_debug);
   my $ran_tests;
-  if (defined($test_case_name)) {
-    if ($test_case_name =~ /^\d+$/) {
-      $ran_tests = [ $test_cases->[$test_case_name-1] ];
-    } else {
-      foreach my $test_case (@$test_cases) {
-        if ($test_case->[0] eq $test_case_name) {
-          $ran_tests = [ $test_case ];
-          last;
-        }
+  if (defined($arg_test_case)) {
+    foreach my $test_case (@$test_cases) {
+      if ($test_case->[0] eq $arg_test_case) {
+        $ran_tests = [ $test_case ];
+        last;
       }
     }
   } else {
@@ -1431,7 +1426,7 @@ sub run_all($$;$$$)
       $test_nrs += $test->test($test_case);
     }
   }
-  if ($generate or $arg_complete) {
+  if ($arg_generate or $arg_complete) {
     plan tests => 1;
   } else {
     plan tests => (1 + $test_nrs);
@@ -1477,12 +1472,6 @@ sub output_texi_file($)
       }
     }
   }
-  my $setfilename;
-  if ($test_text =~ /^\@setfilename/m) {
-    $setfilename = ''
-  } else {
-    $setfilename = "\@setfilename $test_name.info\n";
-  }
   my $node_top;
   if ($test_text =~ /^\@node +top[\s,]/mi
       or $test_text =~ /^\@node +top *$/mi) {
@@ -1503,7 +1492,7 @@ sub output_texi_file($)
   if ($test_text !~ /^\@bye *$/m) {
     $bye = '@bye';
   }
-  foreach my $output ($first_line, $setfilename, $node_top, $added_chapter) {
+  foreach my $output ($first_line, $node_top, $added_chapter) {
     print OUTFILE "$output\n"
       if ($output ne '');
   }
diff --git a/tp/t/xml_tests.t b/tp/t/xml_tests.t
index 837f2afa03..7e2e2f9fdb 100644
--- a/tp/t/xml_tests.t
+++ b/tp/t/xml_tests.t
@@ -349,10 +349,4 @@ foreach my $test (@test_cases) {
   $test->[2]->{'test_formats'} = ['xml'];
 }
 
-our ($arg_test_case, $arg_generate, $arg_debug);
-
-run_all ('xml_tests', [@test_cases], $arg_test_case,
-   $arg_generate, $arg_debug);
-
-1;
-
+run_all('xml_tests', [@test_cases]);



reply via email to

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