* tta/perl/t/z_misc/same_parser_multiple_files.t,
tta/perl/t/z_misc/no_structure_test.t,
tta/perl/XSTexinfo/Parsetexi.pm: use exists or defined in conditions
when the value is not used. Change formatting of functions call code.
diff --git a/ChangeLog b/ChangeLog
index 7683a1e..2e809b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2025-08-31 Patrice Dumas <pertusus@free.fr>
+ * tta/perl/t/z_misc/same_parser_multiple_files.t,
+ tta/perl/t/z_misc/no_structure_test.t,
+ tta/perl/XSTexinfo/Parsetexi.pm: use exists or defined in conditions
+ when the value is not used. Change formatting of functions call code.
+
+2025-08-31 Patrice Dumas <pertusus@free.fr>
+
* tta/C/main/utils.c (print_values_list): add, for debugging.
2025-08-30 Patrice Dumas <pertusus@free.fr>
diff --git a/tta/perl/XSTexinfo/Parsetexi.pm b/tta/perl/XSTexinfo/Parsetexi.pm
index 177b8f9..f0c0dc5 100644
--- a/tta/perl/XSTexinfo/Parsetexi.pm
+++ b/tta/perl/XSTexinfo/Parsetexi.pm
@@ -45,8 +45,7 @@
# Initialize the parser
# The last argument, optional, is a hash provided by the user to change
# the default values for what is present in %parser_document_parsing_options.
-sub parser (;$)
-{
+sub parser(;$) {
my $conf = shift;
my $parser = {};
@@ -56,7 +55,7 @@
# parser configuration, as the configuration isn't already reset and the new
# configuration is set afterwards.
my $debug = 0;
- $debug = $conf->{'DEBUG'} if ($conf and $conf->{'DEBUG'});
+ $debug = $conf->{'DEBUG'} if (defined($conf) and defined($conf->{'DEBUG'}));
# The reset_parser call resets the conf to the same values as found in
# Texinfo::Common parser_document_parsing_options.
@@ -83,7 +82,7 @@
parser_conf_set_documentlanguage($conf->{$key});
}
} elsif ($key eq 'FORMAT_MENU') {
- if ($conf->{$key} and ($conf->{$key} eq 'menu'
+ if (defined($conf->{$key}) and ($conf->{$key} eq 'menu'
or $conf->{$key} eq 'menu_no_detailmenu')) {
parser_conf_set_show_menu(1);
} else {
diff --git a/tta/perl/t/z_misc/no_structure_test.t b/tta/perl/t/z_misc/no_structure_test.t
index e1f1385..d574a0a 100644
--- a/tta/perl/t/z_misc/no_structure_test.t
+++ b/tta/perl/t/z_misc/no_structure_test.t
@@ -41,10 +41,8 @@
use File::Copy;
# NOTE same as in t/z_misc/same_parser_multiple_files.t
-sub _update_test_results_dir($$)
-{
- my $reference_dir = shift;
- my $results_dir = shift;
+sub _update_test_results_dir($$) {
+ my ($reference_dir, $results_dir) = @_;
if (-d $reference_dir) {
unlink_dir_files($reference_dir);
@@ -60,14 +58,9 @@
}
# NOTE same as in t/z_misc/same_parser_multiple_files.t
-sub _do_format_test_file($$$$$$)
-{
- my $test_name = shift;
- my $format = shift;
- my $converter = shift;
- my $document = shift;
- my $test_out_dir = shift;
- my $reference_dir = shift;
+sub _do_format_test_file($$$$$$) {
+ my ($test_name, $format, $converter, $document, $test_out_dir,
+ $reference_dir) = @_;
my $format_type = $format;
diff --git a/tta/perl/t/z_misc/same_parser_multiple_files.t b/tta/perl/t/z_misc/same_parser_multiple_files.t
index dfc0b28..d665a36 100644
--- a/tta/perl/t/z_misc/same_parser_multiple_files.t
+++ b/tta/perl/t/z_misc/same_parser_multiple_files.t
@@ -41,33 +41,26 @@
use File::Copy;
# NOTE same as in t/z_misc/no_structure_test.t
-sub _update_test_results_dir($$)
-{
- my $reference_dir = shift;
- my $results_dir = shift;
+sub _update_test_results_dir($$) {
+ my ($reference_dir, $results_dir) = @_;
- if (-d $reference_dir) {
- unlink_dir_files($reference_dir);
- } else {
- mkdir ($reference_dir);
- }
- my @results_files = glob("$results_dir/*");
- for my $file (@results_files) {
- warn "copy $file to $reference_dir\n";
- File::Copy::copy $file, $reference_dir
+ if (-d $reference_dir) {
+ unlink_dir_files($reference_dir);
+ } else {
+ mkdir ($reference_dir);
+ }
+ my @results_files = glob("$results_dir/*");
+ for my $file (@results_files) {
+ warn "copy $file to $reference_dir\n";
+ File::Copy::copy $file, $reference_dir
if -f $file;
- }
+ }
}
# NOTE same as in t/z_misc/no_structure_test.t
-sub _do_format_test_file($$$$$$)
-{
- my $test_name = shift;
- my $format = shift;
- my $converter = shift;
- my $document = shift;
- my $test_out_dir = shift;
- my $reference_dir = shift;
+sub _do_format_test_file($$$$$$) {
+ my ($test_name, $format, $converter, $document, $test_out_dir,
+ $reference_dir) = @_;
my $format_type = $format;
@@ -142,11 +135,8 @@
my $test_group = 'same_parser_multiple_files';
-sub _run_test($$$)
-{
- my $test_name = shift;
- my $files = shift;
- my $parser_conf = shift;
+sub _run_test($$$) {
+ my ($test_name, $files, $parser_conf) = @_;
print STDERR "TEST $test_name\n" if ($debug);