123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- use strict;
- use Test::More;
- BEGIN {
- require Texinfo::ModulePath;
- Texinfo::ModulePath::init(undef, undef, 'updirs' => 2);
- }
- BEGIN { plan tests => 5; }
- use Texinfo::Parser qw(parse_texi_text);
- use Texinfo::Transformations;
- use Texinfo::Convert::Texinfo;
- use Data::Dumper;
- ok(1);
- sub test($$$)
- {
- my $in = shift;
- my $out = shift;
- my $name = shift;
- my $parser = Texinfo::Parser::parser();
- my $tree = $parser->parse_texi_text($in);
- $parser->Texinfo::Structuring::associate_internal_references();
- my $sectioning = $parser->Texinfo::Structuring::sectioning_structure($tree);
- $parser->Texinfo::Transformations::complete_tree_nodes_menus($tree);
- my $texi_result = Texinfo::Convert::Texinfo::convert($tree);
- if (!defined($out)) {
- print STDERR " --> $name:\n$texi_result";
- } else {
- is ($texi_result, $out, $name);
- }
- }
- test('@node Top
- @top top
- @node chap
- @chapter chap
- ', '@node Top
- @top top
- @menu
- * chap::
- @end menu
- @node chap
- @chapter chap
- ', 'simple');
- test('@node Top
- @top top
- @menu
- * chap::
- * (manual)chap2::
- @end menu
- @node chap
- @chapter chap
- @node chap2
- @chapter chap2
- ', '@node Top
- @top top
- @menu
- * chap::
- * (manual)chap2::
- * chap2::
- @end menu
- @node chap
- @chapter chap
- @node chap2
- @chapter chap2
- ', 'menu completed after');
- test('@node Top
- @top top
- @menu
- * chap2::
- @end menu
- @node chap
- @chapter chap
- @node chap2
- @chapter chap2
- ', '@node Top
- @top top
- @menu
- * chap::
- * chap2::
- @end menu
- @node chap
- @chapter chap
- @node chap2
- @chapter chap2
- ', 'menu completed before');
- test('@node Top
- @top top
- @node nchap1
- @chapter nchap1
- @node nchap2
- @chapter nchap2
- @part
- @node pnchap1
- @chapter pnchap1
- @node pnchap2
- @chapter pnchap2
- @node napp
- @appendix app
- @node nsapp
- @section sapp
- @node anchap1
- @chapter achap1
- @part p2
- @node apnchap1
- @chapter apchap1
- ', '@node Top
- @top top
- @menu
- * nchap1::
- * nchap2::
- * pnchap1::
- * pnchap2::
- * napp::
- * anchap1::
- * apnchap1::
- @end menu
- @node nchap1
- @chapter nchap1
- @node nchap2
- @chapter nchap2
- @part
- @node pnchap1
- @chapter pnchap1
- @node pnchap2
- @chapter pnchap2
- @node napp
- @appendix app
- @menu
- * nsapp::
- @end menu
- @node nsapp
- @section sapp
- @node anchap1
- @chapter achap1
- @part p2
- @node apnchap1
- @chapter apchap1
- ', 'parts');
|