[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 8 Mar 2023 15:05:33 -0500 (EST) |
branch: master
commit bfe602c66d779f446b7db8168a31e8dd16d4e3cb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Mar 8 20:53:51 2023 +0100
* tp/Makefile.tres, tp/t/info_tests.t: add commands_in_sc
tp/t/nodenormalization.t: add two more tests, one corresponding to
commands_in_sc.
---
ChangeLog | 6 +
tp/Makefile.tres | 1 +
tp/t/info_tests.t | 5 +
tp/t/nodenormalization.t | 15 +-
tp/t/results/info_tests/commands_in_sc.pl | 364 ++++++++++++++++++++++++++++++
5 files changed, 389 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8fce5de091..3a847ab17e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,12 @@
name of a subdirectory. This prevents programs that generate info
in a pipeline from being confused in weird working directories.
+2023-03-07 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Makefile.tres, tp/t/info_tests.t: add commands_in_sc
+ tp/t/nodenormalization.t: add two more tests, one corresponding to
+ commands_in_sc.
+
2023-03-07 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Structuring.pm (set_menus_node_directions): use in-tree
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 533187e347..a3f97bd910 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -879,6 +879,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/info_tests/colons_in_index_entries_and_node/res_info \
t/results/info_tests/colons_in_index_entries_and_node_no_quoting.pl \
t/results/info_tests/colons_in_index_entries_and_node_no_quoting/res_info \
+ t/results/info_tests/commands_in_sc.pl \
t/results/info_tests/def_in_copying.pl \
t/results/info_tests/direntry_dircategory.pl \
t/results/info_tests/direntry_dircategory/res_info \
diff --git a/tp/t/info_tests.t b/tp/t/info_tests.t
index 68db18421d..87249c8a5c 100644
--- a/tp/t/info_tests.t
+++ b/tp/t/info_tests.t
@@ -989,6 +989,11 @@ Some text.
@printindex cp
'],
+# this test is mostly used to check the output corresponding
+# to the '@sc content' t/nodenormalization.t test, so it should be modified
+# if the t/nodenormalization.t test is modified
+['commands_in_sc',
+'@sc{a @~n @aa{} @TeX{} @image{myimage} @ref{aref} @verb{!inverb!}
@anchor{inanchor} @hyphenation{hyphena-te} @U{aaaa} @math{ma+th}
@footnote{infootnote}}'],
);
my @file_tests = (
diff --git a/tp/t/nodenormalization.t b/tp/t/nodenormalization.t
index 7574164fd5..9900544cbe 100644
--- a/tp/t/nodenormalization.t
+++ b/tp/t/nodenormalization.t
@@ -5,7 +5,7 @@ use Texinfo::ModulePath (undef, undef, undef, 'updirs' => 2);
use Test::More;
-BEGIN { plan tests => 10; }
+BEGIN { plan tests => 12; }
use Data::Dumper;
use Locale::Messages;
@@ -182,7 +182,7 @@ is ($top_normalized, 'Top', 'normalize Top node');
my $top_and_space_before = ' tOp';
# when parsed with parse_texi_text, the text is put in a paragraph
-# and spaces before the text is put in a speicial content for
+# and spaces before the text is put in a special content for
# spaces before paragraphs, that are ignored afterwards
my $top_and_space_before_tree_text =
$parser->parse_texi_piece($top_and_space_before);
my $top_and_space_before_text_normalized
@@ -205,3 +205,14 @@ my $top_and_spaces_text = 'TOP ';
my $top_and_spaces_tree = $parser->parse_texi_line($top_and_spaces_text);
my $top_and_spaces_normalized = normalize_node($top_and_spaces_tree);
is ($top_and_spaces_normalized, 'TOP-', 'normalize Top node followed by
spaces');
+
+my $empty_command_node_text = '@today{a} @today{b} @today{c} 2';
+my $empty_command_node_tree =
$parser->parse_texi_line($empty_command_node_text);
+my $empty_command_node_normalized = normalize_node($empty_command_node_tree);
+is ($empty_command_node_normalized, '-2', 'node with @today');
+
+my $effect_of_sc_node_text = '@sc{a @~n @aa{} @TeX{} @image{myimage}
@ref{aref} @verb{!inverb!} @anchor{inanchor} @hyphenation{hyphena-te} @U{aaaa}
@math{ma+th} @footnote{infootnote}}';
+my $effect_of_sc_node_tree = $parser->parse_texi_line($effect_of_sc_node_text);
+my $effect_of_sc_node_normalized = normalize_node($effect_of_sc_node_tree);
+is ($effect_of_sc_node_normalized,
'A-_00d1-_00c5-TeX-MYIMAGE-aref-INVERB-AAAA-MA_002bTH-', '@sc content');
+
diff --git a/tp/t/results/info_tests/commands_in_sc.pl
b/tp/t/results/info_tests/commands_in_sc.pl
new file mode 100644
index 0000000000..5f8364c6ec
--- /dev/null
+++ b/tp/t/results/info_tests/commands_in_sc.pl
@@ -0,0 +1,364 @@
+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{'commands_in_sc'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'a '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'n'
+ }
+ ],
+ 'type' => 'following_arg'
+ }
+ ],
+ 'cmdname' => '~',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'aa',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'TeX',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'myimage'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'image',
+ 'extra' => {
+ 'input_perl_encoding' => 'utf-8'
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'aref'
+ }
+ ],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'aref'
+ },
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'ref',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'inverb',
+ 'type' => 'raw'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'verb',
+ 'info' => {
+ 'delimiter' => '!'
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'inanchor'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'anchor',
+ 'extra' => {
+ 'normalized' => 'inanchor'
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' ',
+ 'type' => 'spaces_after_close_brace'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hyphena-te'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'hyphenation',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' ',
+ 'type' => 'spaces_after_close_brace'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'aaaa'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'U',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ma+th'
+ }
+ ],
+ 'type' => 'brace_command_context'
+ }
+ ],
+ 'cmdname' => 'math',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => ' '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'infootnote'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'brace_command_context'
+ }
+ ],
+ 'cmdname' => 'footnote',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'sc',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'commands_in_sc'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[9]{'args'}[0]{'extra'}{'node_content'}[0]
=
$result_trees{'commands_in_sc'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[9]{'args'}[0]{'contents'}[0];
+
+$result_texis{'commands_in_sc'} = '@sc{a @~n @aa{} @TeX{} @image{myimage}
@ref{aref} @verb{!inverb!} @anchor{inanchor} @hyphenation{hyphena-te} @U{aaaa}
@math{ma+th} @footnote{infootnote}}';
+
+
+$result_texts{'commands_in_sc'} = 'A N~ AA TeX MYIMAGE AREF inverb AAAA MA+TH
';
+
+$result_errors{'commands_in_sc'} = [
+ {
+ 'error_line' => '@ref reference to nonexistent node `aref\'
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@ref reference to nonexistent node `aref\'',
+ 'type' => 'error'
+ }
+];
+
+
+$result_floats{'commands_in_sc'} = {};
+
+
+
+$result_converted{'info'}->{'commands_in_sc'} = 'This is , produced from .
+
+A Ñ Å TeX [myimage] *NOTE AREF:: inverb ꪪ MA+TH (1)
+
+ ---------- Footnotes ----------
+
+ (1) infootnote
+
+
+
+Tag Table:
+Ref: inanchor41
+
+End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
+';
+
+$result_converted_errors{'info'}->{'commands_in_sc'} = [
+ {
+ 'error_line' => 'warning: document without nodes
+',
+ 'text' => 'document without nodes',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: could not find @image file `myimage.txt\' nor
alternate text
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => 'could not find @image file `myimage.txt\' nor alternate text',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @anchor outside of any node
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@anchor outside of any node',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @footnote outside of any node
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@footnote outside of any node',
+ 'type' => 'warning'
+ }
+];
+
+
+1;