texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo/tp MANIFEST Makefile.am t/nodenormaliza...


From: Patrice Dumas
Subject: texinfo/tp MANIFEST Makefile.am t/nodenormaliza...
Date: Fri, 30 Sep 2011 07:27:01 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/30 07:27:01

Modified files:
        tp             : MANIFEST Makefile.am 
Added files:
        tp/t           : nodenormalization.t 

Log message:
        Test that Texinfo::Convert::NodeNameNormalization accepts a complete 
        Texinfo tree.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/MANIFEST?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Makefile.am?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/nodenormalization.t?cvsroot=texinfo&rev=1.1

Patches:
Index: MANIFEST
===================================================================
RCS file: /sources/texinfo/texinfo/tp/MANIFEST,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- MANIFEST    29 Sep 2011 08:18:13 -0000      1.8
+++ MANIFEST    30 Sep 2011 07:27:01 -0000      1.9
@@ -51,6 +51,7 @@
 t/30sectioning.t
 t/test_utils.pl
 t/info_tests.t
+t/nodenormalization.t
 t/55conditionals.t
 t/html_tests.t
 t/50value.t

Index: Makefile.am
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Makefile.am 29 Sep 2011 08:18:13 -0000      1.3
+++ Makefile.am 30 Sep 2011 07:27:01 -0000      1.4
@@ -116,6 +116,7 @@
  t/09indices.t \
  t/accents.t \
  t/28heading.t \
+ t/nodenormalization.t \
  t/README \
  t/init/test_renamed_nodes.init \
  t/init/redefine_need.init \

Index: t/nodenormalization.t
===================================================================
RCS file: t/nodenormalization.t
diff -N t/nodenormalization.t
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/nodenormalization.t       30 Sep 2011 07:27:01 -0000      1.1
@@ -0,0 +1,145 @@
+use Test::More;
+BEGIN { plan tests => 3 };
+use lib '../texi2html/lib/Unicode-EastAsianWidth/lib/';
+use lib '../texi2html/lib/libintl-perl/lib/';
+use lib '../texi2html/lib/Text-Unidecode/lib/';
+use Texinfo::Convert::NodeNameNormalization qw(normalize_node);
+use Texinfo::Parser;
+use Data::Dumper;
+
+use strict;
+
+# Currently, tests check that NodeNameNormalization do not break with complete 
+# Texinfo trees, not that the output is correct.
+
+my $srcdir = $ENV{'srcdir'};
+if (defined($srcdir)) {
+  $srcdir =~ s/\/*$/\//;
+} else {
+  $srcdir = '';
+}
+
+my $strings_textdomain = 'texinfo_document';
+Locale::Messages->select_package ('gettext_pp');
+Locale::Messages::bindtextdomain ('texinfo_document', 't/locales');
+
+my $parser = Texinfo::Parser::parser({'TEST' => 1,
+                                        'include_directories' => [
+                                          't/include_dir/',
+                                          't/include/',
+                                          $srcdir.'t/include/'],});
+
+my $invalid_line = '@noindent Text @titlefont{in titlefont} @anchor{in 
address@hidden @exdent exdent';
+
+my $tree = $parser->parse_texi_text($invalid_line);
+#print STDERR Data::Dumper->Dump([$tree]);
+my $normalized_invalid = normalize_node($tree);
+#print STDERR "Invalid: $normalized_invalid\n";
+
+# misc commands are ignored, this implies @node and sectioning contents
+# are ignored...
+my $node_texi = '@node Top
+
+in node
+
address@hidden top section
+
+in top section
+';
+my $node_tree = $parser->parse_texi_text($node_texi);
+my $normalized_node = normalize_node($node_tree);
+is ($normalized_node, '', 'node ignored');
+
+# try on a full manual, but with node and sections commented out
+# as they are ignored
+my $texinfo_manual = '@setfilename toto.info
+
address@hidden some, ;, ;
+
address@hidden fr
+
address@hidden test manual
+
address@hidden
+
+Your rights
address@hidden 2
+Here
address@hidden copying
+
address@hidden 6
+
address@hidden @node Top
address@hidden @top top @~e
+
address@hidden
+
address@hidden
+Para. @LaTeX{}, @address@hidden bbb}. @image{unknown,,,}. @ref{index}
address@hidden @abbr{ABR, expl}. @abbr{ABR}. 
address@hidden@@. @some{infoenclosed}. @today{}.
+
address@hidden index
+
address@hidden
+in html
address@hidden html
+
address@hidden address@hidden {b}
address@hidden gg @tab hhh
address@hidden multitable
+
address@hidden
+in example
address@hidden @emph
address@hidden item
+
address@hidden itemx
+in vtable.
address@hidden vtable
+
address@hidden a b {c} d e f
+in deffn
address@hidden deffn
+
address@hidden exdented
+
address@hidden example
+
address@hidden
+right
address@hidden flushright
+
address@hidden address@hidden, label
+in float
+
address@hidden \frac{a}{b} @\ @minus{}}
+
address@hidden caption}
address@hidden float
+
address@hidden
+* index::
address@hidden menu
+
address@hidden @node index
address@hidden @appendix appendix
+
address@hidden cp
+
address@hidden list of floats
+
address@hidden address@hidden
+
address@hidden
+';
+
+my $manual_tree = $parser->parse_texi_text($texinfo_manual);
+my $check_texinfo = Texinfo::Convert::Texinfo::convert($manual_tree);
+is ($texinfo_manual, $check_texinfo, 'check manual parsing');
+
+#print STDERR Data::Dumper->Dump([$manual_tree]);
+my $normalized_manual = normalize_node($manual_tree);
+#print STDERR "Manual: $normalized_manual\n";
+
+ok($normalized_manual =~ /^[\w\-]+$/, 'normalized tree is a valid id');



reply via email to

[Prev in Thread] Current Thread [Next in Thread]