[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 29 Oct 2024 11:22:54 -0400 (EDT) |
branch: master
commit c3b06d8ecbd0d80d3b515326f05199a9980f7299
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Oct 29 16:22:36 2024 +0100
* tp/Makefile.am (test_files), tp/t/init/stage_handler_bad_return.pm,
tp/t/init/stage_handler_undef_return.pm, tp/tests/Makefile.onetst
(type_base_one_test_files_generated_list),
tp/tests/customization/list-of-tests
(simplest_stage_handler_bad_return)
(simplest_stage_handler_undef_return): add tests of invalid stage
handlers return values.
---
ChangeLog | 10 ++++++++++
tp/Makefile.am | 2 ++
tp/TODO | 1 -
tp/t/init/stage_handler_bad_return.pm | 20 ++++++++++++++++++++
tp/t/init/stage_handler_undef_return.pm | 10 ++++++++++
tp/tests/Makefile.onetst | 2 ++
tp/tests/customization/list-of-tests | 3 +++
.../simplest_stage_handler_bad_return/simplest.1 | 0
.../simplest_stage_handler_bad_return/simplest.2 | 1 +
.../simplest_stage_handler_undef_return/simplest.1 | 0
.../simplest_stage_handler_undef_return/simplest.2 | 1 +
...ustomization_simplest_stage_handler_bad_return.sh | 19 +++++++++++++++++++
...tomization_simplest_stage_handler_undef_return.sh | 19 +++++++++++++++++++
13 files changed, 87 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 7878ae3fce..ce7689ac89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-10-29 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Makefile.am (test_files), tp/t/init/stage_handler_bad_return.pm,
+ tp/t/init/stage_handler_undef_return.pm, tp/tests/Makefile.onetst
+ (type_base_one_test_files_generated_list),
+ tp/tests/customization/list-of-tests
+ (simplest_stage_handler_bad_return)
+ (simplest_stage_handler_undef_return): add tests of invalid stage
+ handlers return values.
+
2024-10-29 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (run_stage_handlers),
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 233b53ba84..fc2c0bfa0e 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -211,6 +211,8 @@ test_files = \
t/init/special_element_customization.pm \
t/init/special_unit_direction_customization.pm \
t/init/special_unit_direction_string_info_customization.pm \
+ t/init/stage_handler_bad_return.pm \
+ t/init/stage_handler_undef_return.pm \
t/init/t2h_buttons.pm \
t/init/t2h_singular.init \
t/init/test_css_info_functions.pm \
diff --git a/tp/TODO b/tp/TODO
index eca29871ef..f6f04c3810 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,7 +10,6 @@ This is the todo list for texi2any
Before next release
===================
-Tests of run_stage_handlers handler returning undef, a float, a string, an hash
Bugs
====
diff --git a/tp/t/init/stage_handler_bad_return.pm
b/tp/t/init/stage_handler_bad_return.pm
new file mode 100644
index 0000000000..5701a1fed4
--- /dev/null
+++ b/tp/t/init/stage_handler_bad_return.pm
@@ -0,0 +1,20 @@
+use strict;
+
+# not tested as it fails silently
+sub _texi2any_tests_bad_return_hash_ref
+{
+ my ($self, $document, $stage) = @_;
+
+ return {'a' => [1]};
+}
+
+#texinfo_register_handler('setup', \&_texi2any_tests_bad_return_hash_ref);
+
+sub _texi2any_tests_bad_return_string
+{
+ my ($self, $document, $stage) = @_;
+
+ return 'what !';
+}
+
+texinfo_register_handler('setup', \&_texi2any_tests_bad_return_string);
diff --git a/tp/t/init/stage_handler_undef_return.pm
b/tp/t/init/stage_handler_undef_return.pm
new file mode 100644
index 0000000000..45e0d1a7e5
--- /dev/null
+++ b/tp/t/init/stage_handler_undef_return.pm
@@ -0,0 +1,10 @@
+use strict;
+
+sub _texi2any_tests_bad_return_undef
+{
+ my ($self, $document, $stage) = @_;
+
+ return undef;
+}
+
+texinfo_register_handler('setup', \&_texi2any_tests_bad_return_undef);
diff --git a/tp/tests/Makefile.onetst b/tp/tests/Makefile.onetst
index d92f360682..4841a4a973 100644
--- a/tp/tests/Makefile.onetst
+++ b/tp/tests/Makefile.onetst
@@ -73,6 +73,8 @@ type_base_one_test_files_generated_list = \
test_scripts/customization_double_contents_book.sh \
test_scripts/customization_double_contents_after_title_book.sh \
test_scripts/customization_double_contents_after_title_book_chapter.sh \
+ test_scripts/customization_simplest_stage_handler_bad_return.sh \
+ test_scripts/customization_simplest_stage_handler_undef_return.sh \
test_scripts/coverage_formatting_macro_expand.sh \
test_scripts/coverage_formatting_info.sh \
test_scripts/coverage_formatting_plaintext.sh \
diff --git a/tp/tests/customization/list-of-tests
b/tp/tests/customization/list-of-tests
index b2fd3f6b15..14b57dd176 100644
--- a/tp/tests/customization/list-of-tests
+++ b/tp/tests/customization/list-of-tests
@@ -16,3 +16,6 @@ double_contents_book ../../t/input_files/double_contents.texi
--html --no-split
double_contents_after_title_book ../../t/input_files/double_contents.texi
--html --no-split --init book.pm -c 'CONTENTS_OUTPUT_LOCATION after_title'
double_contents_after_title_book_chapter
../../t/input_files/double_contents.texi --html --init book.pm --split chapter
-c 'CONTENTS_OUTPUT_LOCATION after_title'
+# test wrong return value from init file handler.
+simplest_stage_handler_bad_return ../formatting/simplest.texi --html --init
stage_handler_bad_return.pm
+simplest_stage_handler_undef_return ../formatting/simplest.texi --html --init
stage_handler_undef_return.pm
diff --git
a/tp/tests/customization/res_parser/simplest_stage_handler_bad_return/simplest.1
b/tp/tests/customization/res_parser/simplest_stage_handler_bad_return/simplest.1
new file mode 100644
index 0000000000..e69de29bb2
diff --git
a/tp/tests/customization/res_parser/simplest_stage_handler_bad_return/simplest.2
b/tp/tests/customization/res_parser/simplest_stage_handler_bad_return/simplest.2
new file mode 100644
index 0000000000..554dac2569
--- /dev/null
+++
b/tp/tests/customization/res_parser/simplest_stage_handler_bad_return/simplest.2
@@ -0,0 +1 @@
+texi2any: handler 1 of stage setup priority default: non-numeric status
diff --git
a/tp/tests/customization/res_parser/simplest_stage_handler_undef_return/simplest.1
b/tp/tests/customization/res_parser/simplest_stage_handler_undef_return/simplest.1
new file mode 100644
index 0000000000..e69de29bb2
diff --git
a/tp/tests/customization/res_parser/simplest_stage_handler_undef_return/simplest.2
b/tp/tests/customization/res_parser/simplest_stage_handler_undef_return/simplest.2
new file mode 100644
index 0000000000..554dac2569
--- /dev/null
+++
b/tp/tests/customization/res_parser/simplest_stage_handler_undef_return/simplest.2
@@ -0,0 +1 @@
+texi2any: handler 1 of stage setup priority default: non-numeric status
diff --git
a/tp/tests/test_scripts/customization_simplest_stage_handler_bad_return.sh
b/tp/tests/test_scripts/customization_simplest_stage_handler_bad_return.sh
new file mode 100755
index 0000000000..a97c1952b1
--- /dev/null
+++ b/tp/tests/test_scripts/customization_simplest_stage_handler_bad_return.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+# This file generated by maintain/regenerate_cmd_tests.sh
+
+if test z"$srcdir" = "z"; then
+ srcdir=.
+fi
+
+one_test_logs_dir=test_log
+
+
+dir=customization
+name='simplest_stage_handler_bad_return'
+mkdir -p $dir
+
+"$srcdir"/run_parser_all.sh -dir $dir $name
+exit_status=$?
+cat $dir/$one_test_logs_dir/$name.log
+exit $exit_status
+
diff --git
a/tp/tests/test_scripts/customization_simplest_stage_handler_undef_return.sh
b/tp/tests/test_scripts/customization_simplest_stage_handler_undef_return.sh
new file mode 100755
index 0000000000..06de5e9318
--- /dev/null
+++ b/tp/tests/test_scripts/customization_simplest_stage_handler_undef_return.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+# This file generated by maintain/regenerate_cmd_tests.sh
+
+if test z"$srcdir" = "z"; then
+ srcdir=.
+fi
+
+one_test_logs_dir=test_log
+
+
+dir=customization
+name='simplest_stage_handler_undef_return'
+mkdir -p $dir
+
+"$srcdir"/run_parser_all.sh -dir $dir $name
+exit_status=$?
+cat $dir/$one_test_logs_dir/$name.log
+exit $exit_status
+