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 (test): test if $document is


From: Patrice Dumas
Subject: branch master updated: * tp/t/test_utils.pl (test): test if $document is undef to determine if the parsing failed.
Date: Thu, 04 Apr 2024 18:40: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 21953f51c7 * tp/t/test_utils.pl (test): test if $document is undef to 
determine if the parsing failed.
21953f51c7 is described below

commit 21953f51c7bab3037e9a069e874d0d54350ad365
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Apr 5 00:40:09 2024 +0200

    * tp/t/test_utils.pl (test): test if $document is undef to determine
    if the parsing failed.
---
 ChangeLog          |  5 +++++
 tp/t/test_utils.pl | 19 +++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 93b3cbc57f..0eea8a96de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-04-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/t/test_utils.pl (test): test if $document is undef to determine
+       if the parsing failed.
+
 2024-04-04  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Common.pm (debug_print_tree):
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 035da2be3f..bdbafdfc04 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1031,9 +1031,7 @@ sub test($$)
     print STDERR "  TEST $test_name ($test_file)\n" if ($self->{'DEBUG'});
     $document = $parser->parse_texi_file($test_file, $XS_structuring);
   }
-  my $tree = $document->tree(1);
-
-  if (not defined($tree)) {
+  if (not defined($document)) {
     print STDERR "ERROR: parsing result undef\n";
     my ($parser_errors, $parser_error_count) = $parser->errors();
     foreach my $error_message (@$parser_errors) {
@@ -1041,6 +1039,8 @@ sub test($$)
         if ($error_message->{'type'} eq 'error');
     }
   }
+  my $tree = $document->tree(1);
+
   my ($errors, $error_nrs) = $parser->errors();
 
   if ($tree_transformations{'fill_gaps_in_sectioning'}) {
@@ -1482,11 +1482,14 @@ sub test($$)
     }
     {
       local $Data::Dumper::Sortkeys = 1;
-      # NOTE file names in error messages are bytes, there could be a
-      # need to decode them if there were file names with non ascii
-      # characters.
-      # FIXME remove the NOTE if file names in error messages are not bytes
-      # anymore
+      # NOTE file names in error messages are bytes.  Since strings written
+      # to the test reference output file (with generate) are encoded to
+      # utf-8, the file names with non ascii characters will have the non ascii
+      # characters encoded twice to utf-8 (in 'file_name' hash keys values).
+      # The bytes would need to be decoded first to character strings to be
+      # correctly encoded to utf-8.  Note that having doubly encoded strings
+      # should not prevent the tests to pass, as both the reference and the
+      # results to check are doubly encoded.
       $out_result .= Data::Dumper->Dump([$errors],
                            ['$result_errors{\''.$test_name.'\'}']) ."\n\n";
       $out_result .= Data::Dumper->Dump([$indices],



reply via email to

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