[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/t/test_utils.pl (output_texi_file): encode t
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/t/test_utils.pl (output_texi_file): encode to UTF-8 the resulting Texinfo file. Only when the test texinfo comes from perl code and not when reading from a file as when reading from a file there is no decoding. |
Date: |
Sun, 27 Nov 2022 10:13:14 -0500 |
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 62a7b0d528 * tp/t/test_utils.pl (output_texi_file): encode to UTF-8
the resulting Texinfo file. Only when the test texinfo comes from perl code
and not when reading from a file as when reading from a file there is no
decoding.
62a7b0d528 is described below
commit 62a7b0d528f105bc7f04e368273eaed1267523e7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 27 16:13:04 2022 +0100
* tp/t/test_utils.pl (output_texi_file): encode to UTF-8 the resulting
Texinfo file. Only when the test texinfo comes from perl code and not
when reading from a file as when reading from a file there is no
decoding.
---
ChangeLog | 7 +++++++
tp/maintain/all_tests.sh | 1 +
tp/t/test_utils.pl | 12 +++++++-----
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 04ead51cf3..cfdb958b4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-11-27 Patrice Dumas <pertusus@free.fr>
+
+ * tp/t/test_utils.pl (output_texi_file): encode to UTF-8 the resulting
+ Texinfo file. Only when the test texinfo comes from perl code and not
+ when reading from a file as when reading from a file there is no
+ decoding.
+
2022-11-27 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/ParserNonXS.pm (_gather_previous_item),
diff --git a/tp/maintain/all_tests.sh b/tp/maintain/all_tests.sh
index 4614005151..965a689503 100755
--- a/tp/maintain/all_tests.sh
+++ b/tp/maintain/all_tests.sh
@@ -63,6 +63,7 @@ else
done
elif [ "$command" = 'texis' ]; then
for file in t/*.t; do
+ echo "$file"
$PERL -w $file -c
done
else
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 6942d1dfd9..f1a28bf4c5 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1625,8 +1625,10 @@ sub output_texi_file($)
mkdir $dir or die
unless (-d $dir);
my $file = "${dir}$test_name.texi";
+ print STDERR "texi: $test_name\n" if ($arg_debug);
open (OUTFILE, ">$file") or die ("Open $file: $!\n");
+ my $encode = 1;
my $first_line = "\\input texinfo \@c -*-texinfo-*-";
if (!defined($test_text)) {
# We do not decode to character strings in internal perl encoding,
@@ -1634,6 +1636,7 @@ sub output_texi_file($)
# character strings containing ascii characters only.
my $test_file;
if ($test_options and $test_options->{'test_file'}) {
+ $encode = 0;
$test_file = $input_files_dir . $test_options->{'test_file'};
if (open (INFILE, $test_file)) {
my $holdTerminator = $/;
@@ -1673,11 +1676,10 @@ sub output_texi_file($)
print OUTFILE "$output\n"
if ($output ne '');
}
- # NOTE $test_text is already encoded if read from a file, but if it is
- # a test string from a *.t file code, it is a perl character string.
- # Therefore there should not be non ascii characters, or alternatively,
- # there should be a way to get the encoding, maybe a regexp on the
- # test string, or a key in $test_options in order to encode $test_text.
+ # $test_text is already encoded if read from a file, but if it is
+ # a test string from a *.t file code, it is a perl character string
+ # and is encoded here, to UTF-8 as it is the default Texinfo encoding.
+ $test_text = Encode::encode('UTF-8', $test_text) if ($encode);
print OUTFILE $test_text;
print OUTFILE "$bye\n" if ($bye ne '');
close (OUTFILE) or die "Close $file: $!\n";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/t/test_utils.pl (output_texi_file): encode to UTF-8 the resulting Texinfo file. Only when the test texinfo comes from perl code and not when reading from a file as when reading from a file there is no decoding.,
Patrice Dumas <=