[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Convert/Info.pm t/info_tests...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Convert/Info.pm t/info_tests... |
Date: |
Sun, 20 Feb 2011 15:52:34 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/02/20 15:52:34
Modified files:
tp/Texinfo/Convert: Info.pm
tp/t : info_tests.t
Added files:
tp/t/results/info_tests: no_nodes.pl no_top_node.pl
Log message:
Warn for index entries outside of nodes.
Warn if there is no Top node.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/info_tests.t?cvsroot=texinfo&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/info_tests/no_nodes.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/info_tests/no_top_node.pl?cvsroot=texinfo&rev=1.1
Patches:
Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- Texinfo/Convert/Info.pm 20 Feb 2011 00:18:15 -0000 1.30
+++ Texinfo/Convert/Info.pm 20 Feb 2011 15:52:34 -0000 1.31
@@ -147,6 +147,10 @@
$result = $output;
}
} else {
+ unless ($self->{'structuring'} and $self->{'structuring'}->{'top_node'}
+ and $self->{'structuring'}->{'top_node'}->{'extra'}->{'normalized'} eq
'Top') {
+ $self->document_warn($self->__("Document without Top node."));
+ }
my $out_file_nr = 1;
my @indirect_files;
if ($fh) {
@@ -395,6 +399,14 @@
my $node_text;
if (!defined($entry->{'node'})) {
$node_text = $self->gdt('(outside of any node)');
+ #Â Warn, but only once.
+ #Â FIXME when outside of sectioning commands this message was already
+ #Â done by the Parser.
+ if (!$self->{'index_entries_no_node'}->{$entry}) {
+ $self->line_warn (sprintf($self->__("Entry for index `%s' outside of
any node"),
+ $index_name),
$entry->{'command'}->{'line_nr'});
+ $self->{'index_entries_no_node'}->{$entry} = 1;
+ }
} else {
$node_text = {'type' => 'code',
'contents' => $entry->{'node'}->{'extra'}->{'node_content'}};
Index: t/info_tests.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/info_tests.t,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- t/info_tests.t 20 Feb 2011 00:18:15 -0000 1.17
+++ t/info_tests.t 20 Feb 2011 15:52:34 -0000 1.18
@@ -3,6 +3,11 @@
require 't/test_utils.pl';
my @test_cases = (
+['no_nodes',
+'Text.'],
+['no_top_node',
+'@node node Top not Top node
+'],
['paragraphindent_and_preamble',
'@copying
In copying.
Index: t/results/info_tests/no_nodes.pl
===================================================================
RCS file: t/results/info_tests/no_nodes.pl
diff -N t/results/info_tests/no_nodes.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/info_tests/no_nodes.pl 20 Feb 2011 15:52:34 -0000 1.1
@@ -0,0 +1,47 @@
+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_trees{'no_nodes'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'Text.'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'text_root'
+};
+$result_trees{'no_nodes'}{'contents'}[0]{'contents'}[0]{'parent'} =
$result_trees{'no_nodes'}{'contents'}[0];
+$result_trees{'no_nodes'}{'contents'}[0]{'parent'} = $result_trees{'no_nodes'};
+
+$result_texis{'no_nodes'} = 'Text.';
+
+
+$result_texts{'no_nodes'} = 'Text.';
+
+$result_errors{'no_nodes'} = [];
+
+
+
+$result_converted{'info'}->{'no_nodes'} = 'This is , produced by makeinfo
version 4.13 from .
+
+Text.
+';
+
+$result_converted_errors{'info'}->{'no_nodes'} = [
+ {
+ 'error_line' => 'warning: Document without nodes.
+',
+ 'text' => 'Document without nodes.',
+ 'type' => 'warning'
+ }
+];
+
+
+1;
Index: t/results/info_tests/no_top_node.pl
===================================================================
RCS file: t/results/info_tests/no_top_node.pl
diff -N t/results/info_tests/no_top_node.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/info_tests/no_top_node.pl 20 Feb 2011 15:52:34 -0000 1.1
@@ -0,0 +1,118 @@
+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_trees{'no_top_node'} = {
+ 'contents' => [
+ {
+ 'contents' => [],
+ 'parent' => {},
+ 'type' => 'text_root'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => ' ',
+ 'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'node Top not Top node'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'spaces_at_end'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [],
+ 'normalized' => 'node-Top-not-Top-node'
+ }
+ ],
+ 'normalized' => 'node-Top-not-Top-node'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'no_top_node'}{'contents'}[0]{'parent'} =
$result_trees{'no_top_node'};
+$result_trees{'no_top_node'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'no_top_node'}{'contents'}[1]{'args'}[0];
+$result_trees{'no_top_node'}{'contents'}[1]{'args'}[0]{'contents'}[1]{'parent'}
= $result_trees{'no_top_node'}{'contents'}[1]{'args'}[0];
+$result_trees{'no_top_node'}{'contents'}[1]{'args'}[0]{'contents'}[2]{'parent'}
= $result_trees{'no_top_node'}{'contents'}[1]{'args'}[0];
+$result_trees{'no_top_node'}{'contents'}[1]{'args'}[0]{'parent'} =
$result_trees{'no_top_node'}{'contents'}[1];
+$result_trees{'no_top_node'}{'contents'}[1]{'extra'}{'node_content'}[0] =
$result_trees{'no_top_node'}{'contents'}[1]{'args'}[0]{'contents'}[1];
+$result_trees{'no_top_node'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}
= $result_trees{'no_top_node'}{'contents'}[1]{'extra'}{'node_content'};
+$result_trees{'no_top_node'}{'contents'}[1]{'parent'} =
$result_trees{'no_top_node'};
+
+$result_texis{'no_top_node'} = '@node node Top not Top node
+';
+
+
+$result_texts{'no_top_node'} = '';
+
+$result_sectioning{'no_top_node'} = {};
+
+$result_nodes{'no_top_node'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'node-Top-not-Top-node'
+ }
+};
+
+$result_menus{'no_top_node'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'node-Top-not-Top-node'
+ }
+};
+
+$result_errors{'no_top_node'} = [];
+
+
+
+$result_converted{'info'}->{'no_top_node'} = 'This is , produced by makeinfo
version 4.13 from .
+
+
+File: , Node: node Top not Top node
+
+
+
+Tag Table:
+Node: node Top not Top node52
+
+End Tag Table
+';
+
+$result_converted_errors{'info'}->{'no_top_node'} = [
+ {
+ 'error_line' => 'warning: Document without Top node.
+',
+ 'text' => 'Document without Top node.',
+ 'type' => 'warning'
+ }
+];
+
+
+1;