[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sun, 29 Sep 2024 09:21:41 -0400 (EDT) |
branch: master
commit 96b8620ad65d3d203e12442e8a099a8263ea2b49
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jun 30 18:18:14 2024 +0200
* tp/Texinfo/XS/parsetexi/separator.c (handle_close_brace): fix @U
argument checking code.
* tp/Makefile.tres, tp/t/03coverage_braces.t (command_in_U): add test.
---
ChangeLog | 9 +++-
tp/Makefile.tres | 1 +
tp/Texinfo/XS/parsetexi/separator.c | 11 ++--
tp/t/03coverage_braces.t | 2 +
tp/t/results/coverage_braces/command_in_U.pl | 81 ++++++++++++++++++++++++++++
5 files changed, 99 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0c18003381..41677fcc80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
2024-06-30 Patrice Dumas <pertusus@free.fr>
- * tp/Texinfo/XS/parsetexi/separator.c (handle_close_brace): fix the
+ * tp/Texinfo/XS/parsetexi/separator.c (handle_close_brace): fix @U
+ argument checking code.
+
+ * tp/Makefile.tres, tp/t/03coverage_braces.t (command_in_U): add test.
+
+2024-06-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/separator.c (handle_close_brace): fix
@dotless argument checking code.
* tp/Makefile.tres, tp/t/03coverage_braces.t (command_in_dotless): add
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 8b8350b9b9..10320e7a08 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -386,6 +386,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/coverage_braces/brace_opened_no_command.pl \
t/results/coverage_braces/caption_not_closed.pl \
t/results/coverage_braces/code_not_closed.pl \
+ t/results/coverage_braces/command_in_U.pl \
t/results/coverage_braces/command_in_dotless.pl \
t/results/coverage_braces/contain_plain_text_nestings.pl \
t/results/coverage_braces/definfoenclose_texinfo_commands.pl \
diff --git a/tp/Texinfo/XS/parsetexi/separator.c
b/tp/Texinfo/XS/parsetexi/separator.c
index 5ff7e74174..437b22d58b 100644
--- a/tp/Texinfo/XS/parsetexi/separator.c
+++ b/tp/Texinfo/XS/parsetexi/separator.c
@@ -476,14 +476,18 @@ handle_close_brace (ELEMENT *current, const char
**line_inout)
}
else if (closed_cmd == CM_U)
{
- if (current->e.c->contents.number == 0)
+ const char *arg_text = 0;
+ if (current->e.c->contents.number > 0
+ && type_data[current->e.c->contents.list[0]->type].flags
+ == TF_text)
+ arg_text = current->e.c->contents.list[0]->e.text->text;
+
+ if (!arg_text || !*arg_text)
{
line_warn ("no argument specified for @U");
}
else
{
- const char *arg_text
- = current->e.c->contents.list[0]->e.text->text;
int n = strspn (arg_text, "0123456789ABCDEFabcdef");
if (arg_text[n])
{
@@ -513,7 +517,6 @@ handle_close_brace (ELEMENT *current, const char
**line_inout)
arg_text);
}
}
-
}
}
else if (parent_of_command_as_argument (brace_command->parent)
diff --git a/tp/t/03coverage_braces.t b/tp/t/03coverage_braces.t
index 21c04ddeae..ce0857cc23 100644
--- a/tp/t/03coverage_braces.t
+++ b/tp/t/03coverage_braces.t
@@ -87,6 +87,8 @@ my @test_cases = (
'],
['command_in_dotless',
'@dotless{@code{i}}'],
+['command_in_U',
+'@U{@code{09AF}}'],
['verb_in_xref',
'@anchor{point}
diff --git a/tp/t/results/coverage_braces/command_in_U.pl
b/tp/t/results/coverage_braces/command_in_U.pl
new file mode 100644
index 0000000000..861fd30a7e
--- /dev/null
+++ b/tp/t/results/coverage_braces/command_in_U.pl
@@ -0,0 +1,81 @@
+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);
+
+use utf8;
+
+$result_trees{'command_in_U'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => '09AF'
+ }
+ ],
+ 'type' => 'brace_container'
+ }
+ ],
+ 'cmdname' => 'code',
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'brace_arg'
+ }
+ ],
+ 'cmdname' => 'U',
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'command_in_U'} = '@U{@code{09AF}}';
+
+
+$result_texts{'command_in_U'} = '09AF';
+
+$result_errors{'command_in_U'} = [
+ {
+ 'error_line' => 'warning: no argument specified for @U
+',
+ 'line_nr' => 1,
+ 'text' => 'no argument specified for @U',
+ 'type' => 'warning'
+ }
+];
+
+
+$result_floats{'command_in_U'} = {};
+
+
+
+$result_converted{'plaintext'}->{'command_in_U'} = '';
+
+
+$result_converted{'html_text'}->{'command_in_U'} = '<p>&#x<code
class="code">09AF</code>;</p>';
+
+
+$result_converted{'latex_text'}->{'command_in_U'} = '';
+
+1;