code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
[ 'nested_macros', '@macro truc   { arg,  ex}
in macro \arg\
@macro othermacro
other macro
@end macro
@macro
@end macro
@end macro
'],
['misc_raw','
@html
in html
 @end html

@tex in tex
@end tex

@verbatim
in  v---erbatim`` <>
in verbatim2
@end verbatim
',
{'expanded_formats' => ['tex', 'html']}
],
['misc_raw_comments','
@html @c comment space
in html @end html@c comment no space

@tex in tex
@end tex    @c comment after end tex

@verbatim
in verbatim @c in verbatim
in verbatim2
@end verbatim
',
{'expanded_formats' => ['tex', 'html']}
],
['raw_in_para',
'para
@verbatim
in verbatim
@end verbatim

para b html
@html
in html
@end html
in para

para b tex
@tex
in tex1

in tex2
@end tex

End.
',
{'expanded_formats' => ['tex', 'html']}
],
['raw_in_example',
'@example
@html
in html
@end html
@end example

@example

@html

Some html some code.

@end html

@tex

$$
\chi^2 = \sum_{i=1}^N
\left(y_i - (a + b x_i)
\over \sigma_i\right)^2
$$

@end tex

@end example

',
{'expanded_formats' => ['tex', 'html']}
],
['braces_in_tex',
'
@tex
$$
\chi^2 = \sum_{i=1}^N
\left(y_i - (a + b x_i)
\over \sigma_i\right)^2
$$
@end tex

@example
@tex
$$
\chi^2 = \sum_{i=1}^N
\left(y_i - (a + b x_i)
\over \sigma_i\right)^2
$$
@end tex
@end example

',
{'expanded_formats' => ['tex']}
],
['lone_braces_in_html',
'@html
}
@end html

@html
{
@end html
',
{'expanded_formats' => ['html']}
],
['verbatim_and_verbatiminclude',
'@verbatim
In verbatim                @@                        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa       bbbbbbbbbbbbbb
@end verbatim

Text before
@verbatim
in verbatime
@end verbatim
Text after

@quotation
In quotation
@verbatim
In verbatim in quotation
In verbatim                @@                        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa       bbbbbbbbbbbbbb
@end verbatim
@end quotation

Before
@verbatim
In verbatim test text
@end verbatim
After

@verbatiminclude verb.txt

@quotation
In quotation include
@verbatiminclude verb.txt
@end quotation

Before include
@verbatiminclude verb.txt
After

@example
In example

@verbatim
In verbatim in example
In verbatim                @@                        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa       bbbbbbbbbbbbbb
@end verbatim

@end example

@quotation
In quotation with spaces

@verbatim
In verbatim in quotation with spaces
In verbatim                @@                        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa       bbbbbbbbbbbbbb
@end verbatim

@end quotation

@quotation
In quotation

@verbatim
In verbatim in quotation
@end verbatim
in quotation after end verbaatim
@end quotation
'],
['raw_commands_and_end_of_lines',
'
@html
Surrounded by empty lines.
@end html

Block commands on a line
@html
in block
in block l2
@end html
end commands on a line.

Before the opening command @html
in block
@end html
end commands on a line.

Before the opening command @html
in block
@end html after the closing command.

Before the opening command @html
in block
@end html
. A symbol on a line.

Before the opening command @html
in block
@end html. A symbol after the closing command.

@tex
Surrounded by empty lines.
@end tex

Block commands on a line
@tex
in block
@end tex
end commands on a line.

Before the opening command @tex
in block
@end tex
end commands on a line.

Before the opening command @tex
in block
@end tex after the closing command.

Before the opening command @tex
in block
@end tex
. A symbol on a line.

Before the opening command @tex
in block
@end tex. A symbol after the closing command.

@verbatim
Surrounded by empty lines.
@end verbatim

Block commands on a line
@verbatim
in block
@end verbatim
end commands on a line.

Before the opening command @verbatim
in block
@end verbatim
end commands on a line.

Before the opening command @verbatim
in block
@end verbatim after the closing command.

Before the opening command @verbatim
in block
@end verbatim
. A symbol on a line.

Before the opening command @verbatim
in block
@end verbatim. A symbol after the closing command.
',
{'expanded_formats' => ['tex', 'html']}
],
['inlinefmt',
'A @inlinefmt{plaintext, plaintext `` @lbracechar{} } a.  Now html
@inlinefmt{html, in @acronym{HTML}}.
'],
['inlineraw',
'A @inlineraw{plaintext, plaintext `` @lbracechar{} } a.  Now html
@inlineraw{html, in @acronym{HTML}}.
'],
['inline_in_example',
'@example
A @inlineraw{plaintext, plaintext

`` @lbracechar{} } a.
@inlinefmt{plaintext, `` }.

  Now html
@inlineraw{html,

in @acronym{HTML}}.
@end example
',
{'expanded_formats' => ['plaintext', 'html']}
],
['raw_in_style',
'@code{
@html
in html
@end html
}'],
['raw_expanded_in_style',
'@code{
@html
in html
@end html
}',{'expanded_formats' => ['html']}, {'expanded_formats' => ['html']}
],
['verbatim_in_brace_command',
'@samp{
@verbatim
in verbatim
@end verbatim
}
'],
);

my @test_invalid = (
['raw_not_closed',
'@html

This is some html
<address> my address </address>
'],
['tex_not_closed',
'@tex

This is some \LaTeX{}
',
{'expanded_formats' => ['tex']}
],
['verbatim_not_closed',
'@verbatim

some verbatim @

@macro

'],
['inlineraw_with_empty_line',
'A @inlineraw{plaintext, plaintext ``

@lbracechar{} } a.  Now html
@inlineraw{html, in

@acronym{HTML}}.
'],
['inlinefmt_with_empty_line',
'A @inlinefmt{plaintext, plaintext ``

@lbracechar{} } a.  Now html
@inlinefmt{html, in

@acronym{HTML}}.
'],
['inline_missing_first_arg',
'@inlinefmt{ , aaa}. @inlineraw{, bbb}.
'],
['beginning_and_end_on_line',
'
@tex in tex @end tex
',
{'expanded_formats' => ['tex']}
],
);

my %html_tests = (
  'raw_in_style' => 1,
  'raw_expanded_in_style' => 1,
  'verbatim_in_style' => 1,
  'raw_in_example' => 1,
  'lone_braces_in_html' => 1,
);

foreach my $test (@test_cases) {
  $test->[2]->{'test_formats'} = ['plaintext'];
  if ($html_tests{$test->[0]}) {
    push @{$test->[2]->{'test_formats'}}, 'html_text';
  }
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('raw', [@test_cases, @test_invalid], $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['quotation_and_author',
'@quotation
@author Some One
A quot---ation
@end quotation

@smallquotation
@author An Author Name
in small---quotation.
@end smallquotation

@quotation Note
@author Some Notifier
A Note
@end quotation
'],
['quotation_author_in_example',
'@example
@quotation
@author Some One
A quot---ation
@end quotation
@end example
'],
['space_at_commands_end_quotation_line',
'
@quotation @@ at the end of line @
A @@ at the end of the @@quotation line.
@end quotation

@quotation @@@  at the end of line @
A @@@  at the end of the @@quotation line.
@end quotation
'],
['empty_quotation',
'@quotation
@end quotation

@quotation Empty
@end quotation

@quotation @asis{}
@end quotation

@quotation @*
@end quotation
'],
['standard_quotations',
'@quotation Note
A Note
@end quotation

@quotation note
A note
@end quotation

@quotation Caution
Caution
@end quotation

@quotation Important
Important
@end quotation

@quotation Tip
a Tip
@end quotation

@quotation Warning
a Warning.
@end quotation
'],
['comment_on_quotation_line',
'@quotation truc@ @c quotation
In quotation
@end quotation
'],
['only_comment_on_quotation_line',
'@quotation @c comment
In quotation
@end quotation
'],
['quotation_beginning_and_end_on_line',
'@quotation in quotation @end quotation
'],
);

our ($arg_test_case, $arg_generate, $arg_debug);

foreach my $test (@test_cases) {
  push @{$test->[2]->{'test_formats'}}, 'plaintext';
  push @{$test->[2]->{'test_formats'}}, 'html_text';
  push @{$test->[2]->{'test_formats'}}, 'xml';
  push @{$test->[2]->{'test_formats'}}, 'docbook';
}

run_all ('quotation', \@test_cases, $arg_test_case,
   $arg_generate, $arg_debug);

repo_name: mthl/texinfo

license: mit


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['w_argument',
'@itemize @w{}
@item @option{--build=} platform on which the program is compiled,
@item @option{--target=} target platform on which the program is processed.
@end itemize
'],
# unclear that these are valid constructs...
['accent_argument',
'@itemize @~@comment
@item item
@end itemize

@itemize @~
@item item
@end itemize
'],
['comment_first_on_itemize_line',
'@itemize @c comment on itemize line
@item first
@end itemize
'],
['enumerate_argument',
'@enumerate 1
@end enumerate

@enumerate A@c comment
@end enumerate

@enumerate z @c comment
@end enumerate
'],
['enumerate_argument_item',
'@enumerate 1
@item numeric first
@item numeric second
@end enumerate

@enumerate A@c comment
@item upper case first
@item upper case second
@end enumerate

@enumerate z @c comment
@item lower case first
@item lower case second
@end enumerate
'],
['comment_first_on_enumerate_line',
'@enumerate @c comment on enumerate line
@item first
@end enumerate
'],
['enumerate_letters',
'@enumerate c
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@item aaa
@end enumerate
'],
['enumerate_in_example',
'
@example
@enumerate
@item first item
@item second  item

still second
@end enumerate
@end example
'],
['itemize_and_empty_lines',
'@itemize youhou
@item first item
@item
@example
In example

end example.
@end example
@item

empty line.
@item

@example
In second example
@end example
@quotation
Quotation
@end quotation

@item

@quotation
quotation after a blank line
@end quotation
@end itemize

@itemize
@item first item
@item
@example
In example

end example.
@end example
@item

empty line.
@item

@example
In second example
@end example
@item
@quotation
Quotation
@end quotation

@item

@quotation
quotation after a blank line
@end quotation
@end itemize

An itemize
@itemize @minus
@item truc
line
@end itemize
After itemize

A nested itemize
@itemize @minus
@item truc
line
@itemize @bullet
@item in nested itemize
@end itemize
After inside nested itemize.
@end itemize
After nested itemize

@itemize @bullet
@item the version number of Texinfo and the program(s) or manual(s) involved.
@item hardware and operating system names and versions.
@item something aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaa
b b bbbbbbbbbbbbbbbbbbbbbbb.
@end itemize
'],
['itemize_long_item',
'@itemize youhou itemize very long item aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccc
@item first item
@item
@example
In example

end example.
@end example
@item

empty line.
@item

@example
In second example
@end example
@item
@quotation
Quotation
@end quotation

@item

@quotation
quotation after a blank line
@end quotation
@end itemize
'],
['enumerate_and_empty_lines',
'@enumerate
@item first item
@item
@example
In example

end example.
@end example
@item

empty line.
@item

@example
In second example
@end example
@item
@quotation
Quotation
@end quotation

@item

@quotation
quotation after a blank line
@end quotation
@end enumerate

@enumerate
@item aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa fffffffff ggggggggg vvvvvvvvv ggggggggg h
@end enumerate
'],
['itemize_line_commands_with_brace',
'@itemize @bullet{}
@item bullet
@end itemize

@itemize @minus{}
@item minus
@end itemize
'],
['asis_as_itemize_argument',
'@itemize @asis
@item as is
@end itemize
'],
['itemize_in_example',
'@example
@itemize @bullet
@item first

more.
@end itemize

@itemize @asis
@item as is
@end itemize

@itemize +
@item item +
@end itemize

@itemize @bullet{} a--n itemize line
@item in an itemize line
@end itemize
@end example
'],
['inter_item_commands_in_itemize',
'@itemize @minus
@c comment in itemize
@cindex also a cindex in itemize
@item e--mph item
@end itemize

@itemize @bullet
@cindex index entry within itemize
@item i--tem 1
@item @cindex index entry right after @@item
i--tem 2
@end itemize

@itemize
@c comment in itemize
T--ext before items.
@cindex also a cindex in itemize
@item bullet item
@end itemize
'],
['inter_item_commands_in_enumerate',
'@enumerate

@comment comment before first item in enumerate
@item e--numerate
@end enumerate

@enumerate
Title
@cindex cindex
@item enum
@end enumerate
'],
);

my @test_invalid = (
['not_closed_item',
'@itemize
@item in item
'],
['not_closed_itemize',
'@itemize
'],
['lone_end_itemize',
'@end itemize
'],
['headitem_itemx_in_itemize',
'@itemize
@item item
@itemx itemx
@headitem headitem
@end itemize
'],
['headitem_itemx_in_enumerate',
'@enumerate
@item item enumerate
@itemx itemx enumerate
@headitem headitem enumerate
@end enumerate
'],
['bad_enumerate_arguments',
'@enumerate a b
@end enumerate

@enumerate !
@end enumerate

@enumerate @code{a}
@end enumerate

@enumerate a@@
@end enumerate

@enumerate a0
@end enumerate
'],
);

foreach my $test (@test_cases) {
  push @{$test->[2]->{'test_formats'}}, 'plaintext';
  push @{$test->[2]->{'test_formats'}}, 'html_text';
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('itemize', [@test_cases, @test_invalid], $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['all_commands',
'@defvr c--ategory d--efvr_name
d--efvr
@end defvr

@deftypefn c--ategory t--ype d--eftypefn_name a--rguments...
d--eftypefn
@end deftypefn

@deftypeop c--ategory c--lass t--ype d--eftypeop_name a--rguments...
d--eftypeop
@end deftypeop

@deftypevr c--ategory t--ype d--eftypevr_name
d--eftypevr
@end deftypevr

@defcv c--ategory c--lass d--efcv_name
d--efcv
@end defcv

@defop c--ategory c--lass d--efop_name a--rguments...
d--efop
@end defop

@deftp c--ategory d--eftp_name a--ttributes...
d--eftp
@end deftp

@defun d--efun_name a--rguments...
d--efun
@end defun

@defmac d--efmac_name a--rguments...
d--efmac
@end defmac

@defspec d--efspec_name a--rguments...
d--efspec
@end defspec

@defvar d--efvar_name
d--efvar
@end defvar

@defopt d--efopt_name
d--efopt
@end defopt

@deftypefun t--ype d--eftypefun_name a--rguments...
d--eftypefun
@end deftypefun

@deftypevar t--ype d--eftypevar_name
d--eftypevar
@end deftypevar

@defivar c--lass d--efivar_name
d--efivar
@end defivar

@deftypeivar c--lass t--ype d--eftypeivar_name
d--eftypeivar
@end deftypeivar

@defmethod c--lass d--efmethod_name a--rguments...
d--efmethod
@end defmethod

@deftypemethod c--lass t--ype d--eftypemethod_name a--rguments...
d--eftypemethod
@end deftypemethod
'],
['end_of_lines_protected',
'@deffn category deffn_name arguments @
   more {args @
  with end of line within} with 3 @@ @@@
 {one last arg}
deffn
@end deffn
'],
['empty_def_command',
'@deffn empty deffn
@end deffn

@deffn empty deffn with deffnx
@deffnx empty deffnx
@end deffn
'],
['leading_space_in_def_arg',
'@deffn category { name} arg
@end deffn
'],
['defx_after_comment',
'@deffn fset @var{i} a g
@c comment
@deffnx {truc} bidulr machin...
@end deffn'],
['inter_item_commands_in_def',
'@deffn fset @var{i} a g
@c comment before first deffnx

@deffnx Command { log trap1} {}
@cindex between deffnx
@deffnx cmde2 @b{id @samp{i} ule} truc
@cindex cindex in deff item

In deff item.
@end deffn
'],
['inter_item_commands_in_def_in_example',
'@example
@deffn fset @var{i} a g
@c comment before first deffnx

@deffnx Command { log trap1} {}
@cindex between deffnx
@deffnx cmde2 @b{id @samp{i} ule} truc
@cindex cindex in deff item

In deff item.
@end deffn
@end example
'],
['defx_after_empty_line',
'@deffn fset @var{i} a g

@deffnx {truc} bidulr machin...
@end deffn'],
['defx_in_example',
'@example
@deffn fset @var{i} a g
@deffnx {truc} bidulr machin...
@end deffn
@end example
'],
['defx_after_comment_in_example',
'@example
@deffn fset @var{i} a g
@c comment
@deffnx {truc} bidulr machin...
@end deffn
@end example
'],
['defx_after_empty_line_in_example',
'@example
@deffn fset @var{i} a g

@c c
@comment comment

@deffnx {truc} bidulr machin...
@end deffn
@end example
'],
['end_of_lines_protected_in_footnote',
'@footnote{
@deffn category deffn_name arguments arg2 @
   more {args @
  with end of line within} with 3 @@ @@@
 {one last arg}
deffn
@end deffn
}
'],
['all_commands_delimiters',
'@deffn Command @var{forward--char} @var{nchars} {argument2} {argument3} @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end deffn

@defvr Variable fill-column {argument1} {argument2} @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end defvr

@deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
@end deftypefn

@deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) @
        (arg in brace, {[something} @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) ct@*@* last
@end deftypefn

@deftypefn {Library Function} int foobug {[something}
@end deftypefn

@deftypefn stacks private push (@var{s}:in out stack; @
                 @var{n}:in integer) ; ;barg aarg; ; end
@end deftypefn

@deftypevr {Global Flag} int enable @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end deftypevr

@deftp {Data type} pair car cdr @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end deftp

@defcv {Class Option} Window border-pattern @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end defcv

@deftypecv {Class Option2} Window @code{int} border-pattern @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end deftypecv

@defop Operation windows expose @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end defop

@deftypeop Operation2 W,indow @code{int} expose @
        (arg in brace, [something @var{in v--ar}, @b{in, b} {, comma} a@var{pref} p]) last
@end deftypeop

@deftypeop Operation5 Window @code{int} expose type arg
@end deftypeop

@deftypeop Operation3 {W,indow} @code{int} {e,xpose} type arg
@end deftypeop

@deftypeop Operation4 {,Window} @code{int} {,expose} type arg
@end deftypeop

@deftypeop Operation6 W,indow @code{int} e,xpose type arg
@end deftypeop

@deftypeop Operation7 ,Window @code{int} ,expose type arg
@end deftypeop

@deftypeop Operation13 {W)indow} @code{int} {e)xpose} type arg
@end deftypeop

@deftypeop Operation14 {)Window} @code{int} {)expose} type arg
@end deftypeop

@deftypeop Operation16 W)indow @code{int} e)xpose type arg
@end deftypeop

@deftypeop Operation17 )Window @code{int} )expose type arg
@end deftypeop

@deftypeop Operation18 {W;indow} @code{int} {e;xpose} type arg
@end deftypeop

@deftypeop Operation19 {;Window} @code{int} {;expose} type arg
@end deftypeop

@deftypeop Operation20 W;indow @code{int} e;xpose type arg
@end deftypeop

@deftypeop Operation21 ;Window @code{int} ;expose type arg
@end deftypeop

@deftypeop Command@code{com} {Window@code{int}} expose@var{exp} name
@end deftypeop

@defun apply function &rest arguments
@end defun

@deffn @var{A1} @var{A2} @var{A3} @var{A4}
@end deffn

@deffn @code{A1} @code{A2} @code{A3} @code{A4}
@end deffn

@defvr @var{A1} @var{A2} @var{A3} @var{A4}
@end defvr

@defvr @code{A1} @code{A2} @code{A3} @code{A4}
@end defvr

@deftypefn @var{A1} @var{A2} @var{A3} @var{A4} @var{A5}
@end deftypefn

@deftypefn @code{A1} @code{A2} @code{A3} @code{A4} @code{A5}
@end deftypefn

@deftypevr @var{A1} @var{A2} @var{A3} @var{A4} @var{A5}
@end deftypevr

@deftypevr @code{A1} @t{A2} @code{A3} @code{A4} @code{A5}
@end deftypevr

@deftp @var{A1} @var{A2} @var{A3} @var{A4}
@end deftp

@deftp @code{A1} @code{A2} @code{A3} @code{A4}
@end deftp

@defcv @var{A1} @var{A2} @var{A3} @var{A4} @var{A5}
@end defcv

@deftp @code{A1} @code{A2} @code{A3} @code{A4} @code{A5}
@end deftp

@deftypecv @var{A1} @var{A2} @var{A3} @var{A4} @var{A5} @var{A6}
@end deftypecv

@deftypecv @code{A1} @code{A2} @option{A3} @code{A4} @code{A5} @code{A6}
@end deftypecv

@defop @var{A1} @var{A2} @var{A3} @var{A4} @var{A5}
@end defop

@defop @code{A1} @code{A2} @code{A3} @code{A4} @code{A5}
@end defop

@deftypeop @var{A1} @var{A2} @var{A3} @var{A4} @var{A5} @var{A6}
@end deftypeop

@deftypeop @code{A1} @code{A2} @code{A3} @code{A4} @code{A5} @code{A6}
@end deftypeop

@deftypefn {code then var} {ret_type} {fun_name} @code{A1} @var{A2} @code{A3} @var{A4}
@end deftypefn

@deftypefn {var then code} {ret_type1} {fun_name1} @var{A1} @code{A2} @var{A3} @code{A4}
@end deftypefn
'],
['protected_brace',
'@deffn c @{
@end deffn
'],
['ref_in_def',
'
@node Top

@deffn @ref{myanchor} @ref{myanchor} {@pxref{myanchor}} @pxref{myanchor} @pxref{myanchor}
@deffnx @ref{myanchor} @ref{myanchor} {@pxref{myanchor}} @pxref{myanchor} @pxref{myanchor}
T
@end deffn

@anchor{myanchor}
'],
);

my @test_info = (
['space_in_def_for_index',
'@node Top

@deffn { Category } { name } { argument } argument2...
@deffnx {AAA1} {AAA2} arg3
@end deffn

@printindex fn
'],
);

my @test_invalid = (
['no_category_or_no_name',
'@deffn
no category no name
@end deffn

@deffn {only category}
no name
@end deffn

@deffn a b c d
@deffnx deffnx_category
@deffnx
with deffnx missing category or name
@end deffn
'],
['def_defx_mismatch',
'@defun {my def} args @var{arg} @dots{}
@deffnx {type} {name} and now the args

In defun.

@end defun
'],
['defx_after_text',
'@deffn fset @var{i} a g
Text in deffn
@deffnx {truc} bidulr machin...
@end deffn'],
['defx_after_paragraph_end',
'@deffn fset @var{i} a g
Text in paragraph.

@deffnx {truc} bidulr machin...
@end deffn'],
['defx_after_preformatted_with_text',
'@example
@deffn fset @var{i} a g
Text in preformatted.

@deffnx {truc} bidulr machin...
@end deffn
@end example
'],
['end_of_line_protect_at_end',
'
@deffn category2 deffn_name2 arguments2 @'],
['end_of_line_end_file',
'@deffn category deffn_name arguments @
'],
# the command with type is compared with the corresponding command without type
['empty_deftype',
'@deftypefun {} f (const type& x)
Deftypefun.
@end deftypefun

@defun f (const type& x)
Defun.
@end defun

@deftypemethod c {} f (const type& x)
Deftypemethod.
@end deftypemethod

@defmethod c f (const type& x)
Defmethod.
@end defmethod
'],
['wrong_braces_simple',
'@deffn truc machin bidule chose and }
@end deffn

@deffn truc machin bidule chose and } after
@end deffn

@deffn truc machin bidule chose and {
@end deffn

@deffn truc machin bidule chose and { and after
@end deffn

@deffn a b c d e
@deffnx truc machin bidule chose and }
@deffnx truc machin bidule chose and } after
@deffnx truc machin bidule chose and {
@deffnx truc machin bidule chose and { and after
@end deffn
'],
['wrong_braces_with_end_of_lines',
'@deffn category name args { @
  more args
deffn with @{
@end deffn

@deffn category name args } @
  more args
deffn with @}
@end deffn
'],
['empty_def_arguments',
'@deffn fset @var{i} a g
@deffnx @b{id @samp{i} ule}
@deffnx
@deffnx aaa
@deffnx {} {}
@deffnx{}
@deffnx{truc} { }
@deffnx{truc}
@deffnx{} {}
@end deffn
'],
['all_empty_def',
'@deffn
@end deffn

@defvr
@end defvr

@deftypefn
@end deftypefn

@deftypeop
@end deftypeop

@deftypevr
@end deftypevr

@defcv
@end defcv

@deftypecv
@end deftypecv

@defop
@end defop

@deftp
@end deftp
'],
['empty_deftypeop_name',
'@deftypeop Command@code{com} {Window@code{int}} expose@var{exp}
@end deftypeop
'],
['double_command',
'@deffn func plot (a, b, c, ...) @deffnx func plot2 (a, b, c, ..., d)
aaa
@end deffn

@deffn func aaaa args  @defvr c--ategory d--efvr_name
bbb
@end deffn
'],
['not_closed',
'@deffn truc bidule machin
@deffnx truc chose args
@defvar type1 var bidule
']
);

my @test_printindex = ();

my %html_tests = (
);

foreach my $test (@test_cases) {
  $test->[2]->{'test_formats'} = ['plaintext'];
  if ($html_tests{$test->[0]}) {
    push @{$test->[2]->{'test_formats'}}, 'html_text';
  }

  if ($test->[0] eq 'all_commands' or $test->[0] eq 'all_commands_delimiters') {
    push @test_printindex, [$test->[0] . '_printindex',
                            '@node Top
'. $test->[1] . '
@heading Functions
@printindex fn

@heading Types
@printindex tp

@heading Variables
@printindex vr
', {'test_formats' => ['info', 'html']}];
  }
}

foreach my $test (@test_info) {
  $test->[2]->{'test_formats'} = ['info', 'html'];
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('def', [@test_cases, @test_info, @test_invalid, @test_printindex], $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['empty_line',
'@example
example

after empty line
@end example
'],
['quote_dash_in_example',
'
@example
and now -- yes---now and ``so\'\'.

@end example
'],
['quote_dash_in_display',
'
@display
and now -- yes---now and ``so\'\'.

@end display
'],
['text_on_command_line',
'@example text on line
@end example

@example text on line followed by text
normal text
@end example

@example
in example
@end example text after end

@example
@example
@end example text after end example nested in example
@end example
'],
['def_in_example',
'@example
@defun name arg
in defun
@end defun
@end example
'],
['caption_in_example',
'@float float

@example
in example

@caption{caption}

After caption
@end example
@end float
'],
['titlefont_in_example',
'@example
@titlefont{Title}
Text.
@end example
'],
['comments_in_example',
'Example with comments 2 lines
@example
line @c comment
second line @c comment
@end example

Example with comments 1 line
@example
line @c comment
@end example

Example with newline after comment
@example
line @c comment

second line
@end example
'],
['nested_example_and_comment',
'@example
First line 0 @c
@example
Nested example
@end example
In first one
@end example

@example
First line 1 @c
@example
Nested example @c
@end example
In first one
@end example

@example
First line 2 @c
@example
Nested example @c
@end example
In first one @c
@end example
'],
['nested_formats',
'@format
@example

in -- format/example

@end example
@end format

@example
@format

in -- example/format

@end format
@end example
'],
['comment_example_and_blank_lines',
'Para.

@example
comment, blank after @c comment
@end example

Para.

@example
comment, no blank after @c comment
@end example
Para.

@example
no comment, blank after
@end example

Para.

@example
no comment, no blank after
@end example
Para.
'],
['page_in_example',
'@example
@page
text
@end example
'],
['insertcopying_in_example',
'@example
@insertcopying
text
@end example
'],
);

my @test_invalid = (
['empty_line_style_command',
'@example
example @samp{in samp

after empty} line
@end example
'],
);

foreach my $test (@test_cases) {
  push @{$test->[2]->{'test_formats'}}, 'plaintext';
  push @{$test->[2]->{'test_formats'}}, 'html_text';
  push @{$test->[2]->{'test_formats'}}, 'docbook';
  push @{$test->[2]->{'test_formats'}}, 'xml';
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('preformatted', [@test_cases, @test_invalid], $arg_test_case,
   $arg_generate, $arg_debug);


code:
# Tests of some uses of @multitable

use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['not_letters_in_prototype',
'@multitable  1.3  5-6
@item 1.3 @tab 5-6
@end multitable
'],

['paragraph_in_cells',
'@multitable {AAA}  {BBB}
@item truc @tab bidule
@item begin item

new paragraph in item.

@tab begin tab

new paragraph in tab.
@end multitable'],
['multitable_in_example',
'@example
@multitable {AAA}  {BBB}
@item truc @tab bidule example
@item begin item example

new paragraph in item. example

@tab begin tab example

new paragraph in tab. example
@end multitable
@end example'],

['w_in_multitable',
'@multitable {aaaaaaaaa} {bbbbbbbbbbb}
@item @w{aaaaaaaa
bbbbbbbbbb}
@tab gg
@end multitable
'],

['inter_item_commands_in_multitable',
'@multitable {truc}
@c comment before first item

@item truc

@cindex index entry between empty lines

@item trouc
@c last comment
@end multitable

@multitable @columnfractions 0.6 0.4
@headitem mu--ltitable headitem @tab another tab
@item mu--ltitable item @tab multitable tab
@c comment in multitable
@item mu--ltitable item 2 @tab multitable tab 2
@cindex index entry within multitable
@item lone mu--ltitable item
@end multitable

@multitable {thing}
Title
@cindex cindex
@item thing
@end multitable

'],

['empty_item_tab',
'@multitable @columnfractions 1.0
@item

@item
@item text
@item
@end multitable

@multitable @columnfractions 0.5 0.5
@item

@item
@item only item

@item item text @tab
@item item new line
@tab

@item @tab
@item
@tab

@item not empty @tab tab not empty
@end multitable
'],

['prototype_brace_no_brace',
'@multitable {aa} bb
@end multitable
'],

['prototype_brace_no_brace_comment',
'@multitable {aa} bb@comment cc
@end multitable
'],

['prototype_no_brace',
'@multitable aa@var{FF} b    cc
@end multitable
'],

['multitable_with_empty_item_tab',
'@multitable @columnfractions 0.3 0.7
@item 1-1 @tab 1-2 @item@tab@item 3-1 @tab 3-2
@end multitable
'],

# Check xrefs in a multitable are treated as if surrounded in @w { ... }.
['ref_in_multitable',
'@novalidate

@ref{XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX XXX XXX XXX XXX
XXX XXX XXX XXX XXX XXX XXX XXX XX}.

@multitable @columnfractions .35 .65
@item XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX
@tab See @ref{RRR RRR RRR RRR RRR RRR RRR RRR RRR RRRR}.
@item XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX
@tab See @ref{SSS SSS SSS SSS SSS SSS SSS SSS SSS SSS SSS SSS SSSSS}.
@item adsf@footnote{@ref{XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX
XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX}} @tab
second column
@end multitable

@ref{XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX XXX XXX XXX XXX
XXX XXX XXX XXX XXX XXX XXX XXX XX}.
'],
);

my @test_invalid = (
['empty_multitable_with_cells',
'@multitable
@item item in empty multitable @tab tab in empty m @tab second tab in empty m
@item item in empty m
@end multitable
'],
['multitable_one_column_too_much_cells',
'@multitable {a}
@item a @tab additional tab @tab other additional tab @tab 3rd  additiona tab
@item a1
@item a2 @tab additional tab2 @tab other additional tab2 @tab 3rd  additional tab2
@item a3 @tab one additional tab
@end multitable
'],
['multitable_two_columns_too_much_cells',
'@multitable @columnfractions 0.4 0.6
@item first @tab second @tab first out @tab second out @tab third out
@item first1
@item first2 @tab second2 @tab first2 out
@end multitable
'],
['multitable_not_closed_item_tab',
'@multitable {r} {t}
@item rt @tab ds
'],
['multitable_not_closed_item',
'@multitable {r} {t}
@item rt
'],
['multitable_not_closed',
'@multitable {r} {t}
'],
['multitable_begin_with_tab',
'@multitable {a} {b}
@tab t
@end multitable

@multitable {c} {d}
@tab t2
@item it
@end multitable
'],
);

foreach my $test (@test_cases) {
  push @{$test->[2]->{'test_formats'}}, 'plaintext';
  push @{$test->[2]->{'test_formats'}}, 'html_text';
  push @{$test->[2]->{'test_formats'}}, 'xml';
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('multitable', [@test_cases, @test_invalid], $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['accent_on_table_line',
'@table @~
@item first item
@item no at-command @code{code}
@end table
'],
['definfoenclose_on_table_line',
'@definfoenclose phi,:,:

@table @phi
@item item
@itemx item x

table content.
@end table
'],
['empty_item_itemx',
'@vtable @asis

VTable

@item first item
@itemx
@itemx after an empty itemx, before an empty item
@item
@item in item before end table
@end vtable
'],
['long_item',
'@table @emph
@item first item      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa
@itemx second itemx bbbbbbbbbbbbbbbbbbbbbbbbbbbbb b b b b b b b b b b b b b

Text.
@end table
'],
['inter_item_commands_in_table',
'@vtable @code
@c comment in table
@item a
l--ine
@end vtable

@vtable @asis
@item a
@c comment between item and itemx
@itemx b
l--ine
@end vtable

@ftable @var
@item a
@cindex index entry between item and itemx
@c and a comment
@comment and another comment
@itemx b
l--ine
@item c

@c comment between lines

@itemx d

@c comment at end
@end ftable

@table @code
@cindex cindex in table
@c comment in table
@item abb
l--ine
@end table

@table @code
@cindex cindex in table
Texte before first item.
@item abb
@end table
'],
['inter_item_commands_in_table_in_example',
'@example
@table @var
@item a
@cindex index entry between item and itemx
@c and a comment
@comment and another comment
@itemx b

@itemx c
l--ine
@item d
@end table
@end example
'],
['block_commands_in_table',
'@node Top
@top Element

@table @emph
@item first item
@itemx second itemx

Text.

@item example
@example
In example

end example.
@end example
@item empty line

empty line.
@item quotation
@quotation
Quotation
@end quotation

@item quotation after a blank line

@quotation
quotation after a blank line
@end quotation
@end table

@vtable @strong
@item item before ignored lines
@c comment
@vindex vindex
@itemx itemx now

Description
@end vtable
@vtable @r
@item item

@itemx itemx after an empty line

Description.

@end vtable

Something.
@table @emph
@item in item
Text without blank line
@item second item
Text without blank line 2
@end table
After table.
'],
['table_nested',
'@macro myvtable
@vtable @asis
@item first item
@itemx second itemx

Text.

@item second item

Text 2

@item last
@end vtable

Something.
@table @emph
@item in item
Text without blank line
@item second item
Text without blank line 2
@end table
After table.
@end macro

Quotation
@quotation
@myvtable{}
@end quotation

Example
@example
@myvtable{}
@end example

Double quotation
@quotation
@quotation
@myvtable{}
@end quotation
@end quotation
'],
['comment_and_itemx_before_item',
'@table @code
@c comment
@itemx in itemx
@end table
'],
);

my @test_invalid = (
['lone_end_table',
'Text.
@end table
'],
['invalid_command_and_brace_in_table',
'@table @asis
{ @itemTop,, title
long title}
Item line
@end table
'],
['headitem_in_table',
'@table @strong
@headitem headitem in table

headitem In table text.

@item item
@end table
'],
['no_arg_brace_command_on_table_line',
'@table @bullet
@item item
@end table
'],
['no_argument_for_table',
'@table
@item item
In item.
@end table
'],
['text_between_item_itemx',
'@table @strong
@item in item
text
@itemx in itemx
@end table
'],
['itemx_before_item',
'@table @emph
@itemx in itemx
@end table
'],
['title_and_itemx_before_item',
'@table @emph
Title
@itemx in itemx
@end table
'],
);

foreach my $test (@test_cases) {
  push @{$test->[2]->{'test_formats'}}, 'plaintext';
  push @{$test->[2]->{'test_formats'}}, 'html_text';
  push @{$test->[2]->{'test_formats'}}, 'xml';
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('xtable', [@test_cases, @test_invalid], $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['copying_not_closed',
'@copying

This is a copyright notice
'],
['double_copying',
'@copying

This is a copyright notice

@copying
And a second one (?)
@end copying
@end copying
'],
['double_titlepage_not_closed',
'@titlepage

This is in title page

@titlepage

And still in title page
']
);

my $format_in_titlepage_text = '@titlepage

@format
Published
@end format

@end titlepage

@node Top

';

my $anchor_in_titlepage_text =
'@titlepage

@anchor{in titlepage}
@end titlepage

@top top
@node Top

@xref{in titlepage}.
';

my @test_formatted = (
['anchor_in_copying',
'
@copying

Copying.
@anchor{Copying information}

@end copying

@node Top

@insertcopying

@insertcopying

@xref{Copying information}.

'],
['anchor_in_copying_in_footnote',
'@copying

Copying@footnote{
In footnote.
@anchor{Copying footnote}
}.

@end copying

@node Top

@insertcopying

@insertcopying

@xref{Copying footnote}.

'],
['format_in_titlepage',
$format_in_titlepage_text
],
['format_in_titlepage_titlepage',
$format_in_titlepage_text, {}, {'USE_TITLEPAGE_FOR_TITLE' => 1}
],
['anchor_in_titlepage',
$anchor_in_titlepage_text
],
['anchor_in_titlepage_titlepage',
$anchor_in_titlepage_text, {}, {'USE_TITLEPAGE_FOR_TITLE' => 1}
],
['ref_in_copying',
'@copying
@ref{GFDL}
@end copying

@node Top
@top top

@insertcopying

@menu
* GFDL::
@end menu

@node GFDL
@chapter GFDL

'],
['today_in_copying',
'@copying
@today{}.
@end copying

@node Top
@top top

@insertcopying
',{},{'TEST' => 1}],
);

foreach my $test (@test_formatted) {
  push @{$test->[2]->{'test_formats'}}, 'info';
  push @{$test->[2]->{'test_formats'}}, 'html';
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('regions', [@test_cases, @test_formatted], $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['listoffloats_with_commands',
'@listoffloats th@\'eor@`eme
'],
['empty_listoffloats',
'@listoffloats
'],
['simple',
'@float Type, Label

In float.
@caption{Caption.}
@end float'],
['ref_to_float',
'@float Text, Label1
Float
@end float

@float , Label2
In foat 2.
@end float

@ref{Label1}

@ref{Label2}
'],
['float_with_at_commands',
'@float entr@\'ee, premi@`ere entr@\'ee

Ceci est notre premi@`ere entr@\'ee.
@caption{La premi@`ere entr@\'ee est importante}

@end float

@listoffloats entr@\'ee
'],
['footnote_in_caption',
'@node Top

@listoffloats fl

@float fl, label
In float.
@caption{in caption@footnote{in footnote}}
@end float
'],
['footnote_in_caption_and_error',
'@node Top

@listoffloats fl

@float fl, label
In float.
@caption{in caption@footnote{in footnote @error}}
@end float
'],
['anchor_in_caption',
'@node Top

@listoffloats fl

@float fl, label
In float.
@caption{in caption@anchor{in anchor}}
@end float
'],
['cindex_in_caption',
'@node Top

@listoffloats fl

@float fl, label
In float.
@caption{in caption
@cindex index entry
}
@end float

@printindex cp

'],
['complex_float',
'@node Top
@top Test floats

A list of floats at the beginning.
@listoffloats Text

After the listoffloats.
@menu
* chapter::
@end menu

@float Text, text with a lot of features
An example of float @enddots{}

@c makeinfo --docbook segfaults
@ifset texi2html
An example.
@example
example
@end example

A multitable.
@multitable {truc} {bidule}
@item truc @tab bidule
@item truc @tab bidule
@end multitable
@end ifset

An index entry
@cindex float example

A table.
@table @emph
@item truc
line
@end table

An itemize.
@itemize @minus
@item truc
line
@end itemize

A ref.
@xref{Top,xref Text with features}.
A footnote.
@footnote{footnote Text with features}.

@TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.

@caption{ An example of float caption@enddots{}
An example.
@example
example
@end example

@anchor{Anchor in caption}

A table.
@table @emph
@item truc
line
@end table

A multitable.
@multitable {truc} {bidule}
@item truc @tab bidule
@item truc @tab bidule
@end multitable
An index entry
@cindex float example in caption

An itemize.
@itemize @minus
@item truc
line
@end itemize

A ref.
@xref{Top,xref Text with features caption}.
A footnote.
@footnote{footnote Text with features caption}.

@TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.
}

@shortcaption{@TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.}

@end float

@node chapter
@chapter A chapter

@float Text, float with a lot of features and no shortcaption

Float text of a float with a lot of features.

@caption{ An example of float caption@enddots{} 2
An example 2.
@example
example 2
@end example

A table 2.
@table @emph
@item truc 2
line 2
@end table

A multitable 2.
@multitable {truc} {bidule}
@item truc 2 @tab bidule
@item truc 2 @tab bidule
@end multitable
An index entry 2
@cindex float example in caption 2

An itemize 2.
@itemize @minus
@item truc 2
line
@end itemize

@anchor{Anchor in caption 2}

A ref 2.
@xref{Top,xref Text with features caption}.
A footnote 2.
@footnote{footnote Text with features caption 2}.

@TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.
}

@end float

@xref{text with a lot of features}.

'],
['numbering_captions_listoffloats',
'@node Top
@top Test floats

@float Text, text with a lot of features

@caption{ An example of float caption@enddots{}}
@shortcaption{@TeX{} and someething}
@end float

@float Text
No label but caption and shortcaption.

@caption{C No label}
@shortcaption{SC No label}
@end float

@float ,label but no type
No type but caption and shortcaption.

@caption{C No type}
@shortcaption{SC No type}
@end float

@float ,label but no type and no caption
No type but label and no caption nor shortcaption.

@end float

@float
No label, no type, no caption no shortcaption.

@end float

@float
No label, no type, but caption and shortcaption.
@caption{C No label, no type, but caption and shortcaption.}
@shortcaption{SC No label, no type, but caption and shortcaption.}
@end float

@float ,label but no type 2
Second float with no type.

@caption{C No type 2}
@shortcaption{SC No type 2}
@end float

@float Warning, warning in top
A warning

@caption{C A warning}
@shortcaption{SC A warning}
@end float

@menu
* chapter::
* Unnumbered::
* Chapter with unnumbsubsec::
* Appendix for float::
* list of floats::
@end menu

@node chapter
@chapter A chapter

@float Text, text in chapter
Text in chapter

@caption{C Text in chapter}
@end float

@float Text, float with a lot of features and no shortcaption
@caption{ An example of float caption, no shortcaption@enddots{}}
@end float

@float th@\'eor@`eme, theoreme
A th@\'eor@`eme

@caption{C A th@\'eor@`eme}
@end float

@float ,label but no type in chapter
float with no type.

@caption{C No type in chapter}
@shortcaption{SC No type in chapter}
@end float

@float Warning, warning in chapter
A warning

@caption{C A warning in chapter}
@shortcaption{SC A warning in chapter}
@end float

@menu
* section::
@end menu

@node section
@section A section

@float Text, text in section

A text in float no caption a label a type.

@end float

@node Unnumbered
@unnumbered Unnumbered

@menu
* Section within unnumbered::
@end menu
@float Text, unnumbered float
unnum
@shortcaption{SC unnumbered float}
@caption{C unnumbered float}
@end float
@float ,label but no type in unnumbered
float with no type.

@caption{C No type in unnumbered}
@shortcaption{SC No type in unnumbered}
@end float

@node Section within unnumbered
@section Section within unnumbered

@float Text, Section within unnumbered float
Section within unnumbered
@shortcaption{SC Section within unnumbered}
@caption{C Section within unnumbered}
@end float

@node Chapter with unnumbsubsec
@chapter Chapter with unnumbsubsec

@menu
* unnumbered sec::
@end menu
@float Text, Chapter with subsec float
Chap
@shortcaption{SC Chapter with subsec}
@caption{C Chapter with subsec}
@end float

@node unnumbered sec
@unnumberedsec unnumbered sec

@float Text, unnumbered sec float
Chap
@shortcaption{SC unnumbered sec float}
@caption{C unnumbered sec float}
@end float

@float ,label but no type in unnumbered subsec in chapter
float with no type.

@caption{C No type in unnumbered subsec in chapter}
@shortcaption{SC No type in unnumbered subsec in chapter}
@end float

@node Appendix for float
@appendix Appendix for float

@float Text, appendix sec float

Appendix
@shortcaption{SC appendix sec float}
@caption{C appendix sec float}
@end float

@node list of floats
@unnumbered list of floats

See @ref{text in section}.
And (@pxref{text in chapter}).
@xref{text with a lot of features}.

And now a ref (without manual or printed manual)
@ref{text with a lot of features, cross ref, title}.

And now a ref (with manual without printed manual)
@ref{text with a lot of features, cross ref, title, manual}.

And now a ref (without manual with a printed manual)
@ref{text with a lot of features, cross ref, title,, printed manual title}.

A ref to float without type @ref{label but no type}.

@listoffloats Text
@listoffloats th@\'eor@`eme

@bye

'],
['empty_listoffloats_with_floats',
'
@float , label1
Label no caption.
@end float

@float , label2
Label and caption.
@caption{caption with label}
@end float

@float
no label no caption
@end float

@float
no label caption
@caption{caption no label}
@end float

@listoffloats
'],
['float_copying',
'@copying

@float Copyright notice, public domain

Public domain is not really a licence, as it means than
the author abandon his copyright.

@caption{The Public Domain notice@footnote{
The caption copying footnote
@anchor{caption copying footnote anchor}

@cindex indexed caption copying footnote
@findex public domain function

see @ref{Copying and floats}.

}

@anchor{public domain anchor}
@cindex indexed caption
@findex indexed caption function
}
@end float
@end copying

@node Top
@top Top

@insertcopying

@menu
* Copying and floats::
@end menu

@node Copying and floats
@appendix Copying and floats

@insertcopying
@insertcopying

@listoffloats Copyright notice

@printindex cp
@printindex fn
'],
['comment_space_comand_in_float',
'@node Top

@float Text @ , label @ @c float
Float
@end float

@listoffloats Text @ @c listoffloats
']
);

my %info_tests = (
  'anchor_in_caption' => 1,
  'footnote_in_caption' => 1,
  'cindex_in_caption' => 1,
  'float_copying' => 1,
  'comment_space_comand_in_float' => 1,
);

foreach my $test (@test_cases) {
  $test->[2]->{'test_formats'} = ['plaintext'];
  if ($info_tests{$test->[0]}) {
    push @{$test->[2]->{'test_formats'}}, 'info';
  }
  push @{$test->[2]->{'test_formats'}}, 'html';
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('float', \@test_cases, $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
['heading_in_copying',
'@copying

@heading in copying @@ @emph{heading}
@cindex cindex copying

@subheading second in copying @@ @emph{subheading}
@end copying

@node Top

@insertcopying
'],
['heading_in_quotation',
'@quotation

@heading in quotation @@ @emph{heading}

@end quotation
'],
['heading_in_example',
'@example
@heading in example @@ @emph{heading}
@end example
']
);

our ($arg_test_case, $arg_generate, $arg_debug);

foreach my $test (@test_cases) {
  $test->[2]->{'test_formats'} = ['plaintext', 'html'];
}

run_all ('heading', \@test_cases, $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my $sections_no_top_text =
'@chapter chapter

@section section

@subsection subsection

@subsubsection subsubsection

@part part

@chapter chapter in part

@chapter second chapter in part

@unnumbered unnumbered

@appendix appendix

@appendixsec appendixsec
';

my $test_text =
'@top top

'.$sections_no_top_text;

my $chapter_sections_text =
'@unnumbered unnumbered

@chapter First chapter

@section second

@chapter Chapter

@section Section of chapter

@subsection subsection 1

@subsection subsection 2

@chapter Chapter 2
';

my $top_chapter_sections_text =
'@top top

'.$chapter_sections_text;

my $unnumbered_top_without_node_text =
'@node a node,,,(dir)
@unnumbered unnumbered

in unnumbered

@top top section
Top section

@node second,,,(dir)
@chapter Chapter

Text of chapter
';

my $top_without_node_text =
'@top top section
Top section

@node second,,,(dir)
@chapter Chapter

Text of chapter
';

my $section_in_unnumbered_text = '
@node Top
@top Test section in unnumbered

@contents

Menu:

@menu
* chapter::
* unnumbered::
* chapter 2::
* chapter 3::
* unnumbered 4::
@end menu

@node chapter
@chapter chapter

@menu
* section in chapter::
@end menu

@node section in chapter
@section section in chapter

@node unnumbered
@unnumbered unnumbered

@menu
* section in unnumbered::
@end menu

@node section in unnumbered
@section section in unnumbered

@node chapter 2
@chapter chapter 2

@menu
* unnumberedsec 2::
* unnumberedsec 2-1::
@end menu

@node unnumberedsec 2
@unnumberedsec unnumbered section 2

@menu
* unnumbered sub 2::
* numbered sub 2::
* unnumbered sub2 2::
* numbered sub2 2::
@end menu

@node unnumbered sub 2
@unnumberedsubsec unnumbered subsection 2

@node numbered sub 2
@subsection numbered subsection 2

@node unnumbered sub2 2
@unnumberedsubsec unnumbered subsection2 2

@node numbered sub2 2
@subsection numbered subsection2 2

@node unnumberedsec 2-1
@unnumberedsec unnumberedsec 2-1

@menu
* numbered sub 2-1::
@end menu

@node numbered sub 2-1
@subsection numbered subsection 2-1

@node chapter 3
@chapter chapter 3

@menu
* unnumberedsec 3::
* section 3-1::
* unnumberedsec 3-2::
* section 3-3::
* unnumberedsec 3-4::
@end menu

@node unnumberedsec 3
@unnumberedsec unnumbered section 3

@menu
* unnumbered sub 3::
* numbered sub 3::
* unnumbered sub2 3::
* numbered sub2 3::
@end menu

@node unnumbered sub 3
@unnumberedsubsec unnumbered subsection 3

@node numbered sub 3
@subsection numbered subsection 3

@node unnumbered sub2 3
@unnumberedsubsec unnumbered subsection2 3

@node numbered sub2 3
@subsection numbered subsection2 3

@node section 3-1
@section section 3-1

@node unnumberedsec 3-2
@unnumberedsec unnumberedsec 3-2

@menu
* numbered sub 3-2::
@end menu

@node numbered sub 3-2
@subsection numbered subsection 3-2

@node section 3-3
@section section 3-3

@menu
* subsection 3-3::
@end menu

@node subsection 3-3
@subsection subsection 3-3

@node unnumberedsec 3-4
@unnumberedsec unnumberedsec 3-4

@menu
* numbered sub 3-4::
@end menu

@node numbered sub 3-4
@subsection numbered subsection 3-4

@node unnumbered 4
@unnumbered unnumbered  4

@menu
* unnumberedsec 4::
@end menu

@node unnumberedsec 4
@unnumberedsec unnumbered section 4

@menu
* unnumbered sub 4::
* numbered sub 4::
* unnumbered sub2 4::
* numbered sub2 4::
@end menu

@node unnumbered sub 4
@unnumberedsubsec unnumbered subsection 4

@node numbered sub 4
@subsection numbered subsection 4

@node unnumbered sub2 4
@unnumberedsubsec unnumbered subsection2 4

@node numbered sub2 4
@subsection numbered subsection2 4
';

my $anchor_in_footnote_text = '@node Top
@top Top

In top node@footnote{in footnote
@anchor{Anchor in footnote}.
}

@menu
* chapter::
@end menu

@node chapter
@chapter Chap

@ref{Anchor in footnote}.
';

my $nodes_after_top_before_chapter_text =
'@node Top
Top node
@menu
* second node::
* third node::
@end menu

@node second node, third node,Top,Top

second node

@node third node,,second node,Top
@chapter chapter
';

my $nodes_after_top_before_section_text =
'@node Top
Top node
@menu
* second node::
* third node::
@end menu

@node second node, third node,Top,Top

second node

@node third node,,second node,Top
@subsection subsection
';

my @tests_converted = (
['contents',
$test_text.
'
@contents
'],
['shortcontents',
$test_text.
'
@shortcontents
'],
['contents_and_shortcontents',
$test_text.
'
@shortcontents

@contents
'],
['one_subsection',
'@subsection The subsection
'],
['section_below_unnumbered',
'
@contents

@node Top
@top Top

Top node.

@menu
* Unn::
@end menu

@node Unn
@unnumbered Unn

@menu
* Sec::
@end menu

@node Sec
@section Sec

Should be unnumbered.

@bye
'],
['section_below_unnumbered_no_top',
'@unnumbered U
@section S
'],
['top_no_argument_and_content',
'@top

A.
'],
['section_before_part',
'@section section

@part part

@contents
'],
['chapter_before_part',
'@chapter chapter

@part part
',{'test_split' => 'section'}],
['part_before_top',
'@part part

@top top
',{'test_split' => 'section'}],
['part_before_chapter',
'@part part

@chapter chapter
',{'test_split' => 'section'}],
['double_part',
'@node Top
@top top

@menu
* node chapter::
@end menu

@part part first

Text part first.
@part part second
Text part second.

@node node chapter
@chapter chapter after 2 parts

', {'test_split' => 'section', 'test_split_pages' => 'chapter'}
],
['setfilename_on_top_and_after_node',
'@node Top
@top In top @setfilename very badly placed setfilename

@setfilename a bit too late
'],
['section_in_unnumbered_plaintext',
$section_in_unnumbered_text
],
['two_unnumbered_no_argument',
'@unnumbered
@unnumbered
'],
['no_argument_and_contents',
'@contents

@top for example

@chapter @asis{}

'],
['node_up_external_node',
'@node Top

@menu
* first::
@end menu

@node first, (manual1), (manual2) , (manual3)
', {'test_split' => 'node'}],
['two_nodes_between_chapters',
'@node Top
@top top

@menu
* chapter 1::
* node between chapters::
* chapter 2::
@end menu

@node chapter 1, Top, node between chapters, Top
@chapter chapter c1

@node node between chapters

@node chapter 2
@chapter chapter c2
', {'test_split' => 'section'}],
['two_nodes_at_the_end',
'@node Top
@top top

@menu
* chapter 1::
* node after chapter 1::
* node after chapter 2::
@end menu

@node chapter 1, node after chapter 1, Top, Top
@chapter chapter c1

@node node after chapter 1

@node node after chapter 2
', {'test_split' => 'section'}],
['chapter_before_and_after_part',
'@chapter chapter

@part part

@chapter chapter 2

@contents
', {'test_split' => 'section'}
],
['lone_contents',
'@contents
'],
['contents_with_only_top_node',
'
@node Top

@contents
'],
);

my $character_and_spaces_in_refs_text = '@node Top
@top Test refs

@menu
* other nodes::
@end menu

@subheading Testing distant nodes

@ref{ a  node ,,, manual}
@ref{:,,,manual}
@ref{ top ,,, manual}
@ref{(texinfo)Cross References}
@ref{node,,, ../manual/doc.texi}

@subheading Testing local nodes

@ref{!_"#$%&\'()*+-.}
@ref{/;<=>?[\\]^_`|~}
@ref{ Top}
@ref{  local   node}

@node other nodes, !_"#$%&\'()*+-., Top, Top
@chapter Chapter with nodes

@menu
* !_"#$%&\'()*+-.::
* /;<=>?[\\]^_`|~::
* local node::
@end menu

@node !_"#$%&\'()*+-., /;<=>?[\]^_`|~, other nodes, other nodes

@node /;<=>?[\]^_`|~,local   node,!_"#$%&\'()*+-., other nodes

@node  local   node,,/;<=>?[\\]^_`|~,other nodes

@bye
';

my @tests_info = (
['anchor_zero',
'@node Top

@anchor{0}.

@xref{0}.
'],
['top_no_argument_and_node',
'@node start
@top
'],
['top_no_argument_and_top_node',
'@node Top
@top
'],
['one_subsection_and_node',
'@node one node
@subsection The subsection
'],
['character_and_spaces_in_refs',
$character_and_spaces_in_refs_text],
['character_and_spaces_in_node',
'
@node Top
@node other nodes, !_"#$%&\'()*+-., Top, Top
@node !_"#$%&\'()*+-., /;<=>?[\\]^_`|~, other nodes, other nodes
@node /;<=>?[\\]^_`|~,local   node,!_"#$%&\'()*+-., other nodes
@node  local   node,,/;<=>?[\\]^_`|~,other nodes
'],
['double_node_anchor_float',
'@node node1

@node node1

@anchor{node1}

@anchor{anchor1}

@node anchor1

@float Text, node1
@end float

@float Text, anchor1
@end float

@float Text, float1
@end float

@node float1
'],
['double_top',
'@node ToP, top

@node top,,ToP,Top

@anchor{TOP}.
'],
['ref_to_top',
'
@node ToP
@top top

@xref{TOP}.
'],
['equivalent_nodes',
'@node Top, @emph{node}

@menu
* @strong{node}::
@end menu

@node @samp{node}

@xref{node}.
'],
['equivalent_labels',
'@node Top

@anchor{@samp{anch}}.

@float truc, floa
In float
@end float

@menu
* anch::
* @code{floa}::
@end menu
'],
['anchor_in_footnote',
$anchor_in_footnote_text
],
['anchor_in_footnote_separate',
'@footnotestyle separate
'.
$anchor_in_footnote_text
],
['no_element',
'@settitle no_element test
@documentencoding ISO-8859-1

@anchor{An anchor}

Ref to the anchor:
@ref{An anchor}

Ref to the anchor in footnote:
@ref{Anchor in footnote}.

@footnote{In footnote.

@anchor{Anchor in footnote}

Ref to main text anchor
@ref{An anchor}
}

@float , float anchor
In float
@end float

Ref to float
@ref{float anchor}.

@menu
* An anchor::                menu entry pointing to the anchor.
@end menu

@cindex index entry
'],
['placed_things_before_element',
'@anchor{An anchor}

Ref to the anchor:
@ref{An anchor}

Ref to the anchor in footnote:
@ref{Anchor in footnote}.

@footnote{In footnote.

@anchor{Anchor in footnote}

Ref to main text anchor
@ref{An anchor}
}

@float , float anchor
In float
@end float

Ref to float
@ref{float anchor}.

@menu
* An anchor::                menu entry pointing to the anchor.
@end menu

@cindex index entry

@section section

Ref to anchor
@ref{An anchor}

Ref to footnote anchor
@ref{Anchor in footnote}
'],
['placed_things_before_node',
'@anchor{An anchor}

Ref to the anchor:
@ref{An anchor}

Ref to the anchor in footnote:
@ref{Anchor in footnote}.

@footnote{In footnote.

@anchor{Anchor in footnote}

Ref to main text anchor
@ref{An anchor}
}

@float , float anchor
In float
@end float

Ref to float
@ref{float anchor}.

@menu
* An anchor::                menu entry pointing to the anchor.
@end menu

@cindex index entry

@node Top
@top top section

Ref to anchor
@ref{An anchor}

Ref to footnote anchor
@ref{Anchor in footnote}
'],
['explicit_node_directions',
'@node Top
Top node
@menu
* second node::
* third node::
@end menu

@node second node, third node,Top,Top

second node

@node third node,,second node,Top
', {'test_split' => 'node'}],
['nodes_after_top_before_chapter_nodes',
$nodes_after_top_before_chapter_text,
{'test_split' => 'node'}],
['nodes_after_top_before_chapter_sections',
$nodes_after_top_before_chapter_text,
{'test_split' => 'section'}],
['nodes_after_top_before_section_nodes',
$nodes_after_top_before_section_text,
{'test_split' => 'node'}],
['nodes_after_top_before_section_sections',
$nodes_after_top_before_section_text,
{'test_split' => 'section'}],
['top_node_no_menu_direction',
'@node Top

@menu
* second node::
* TOP:: myself
@end menu

@node second node,,top,TOP
'],
['nodes_no_node_top_explicit_directions',
'@node first,,,(dir)
first node

@menu
* second node::
@end menu

@node second node,,first,first
second node
',{'test_split' => 'node'}],
['one_node_explicit_directions_anchor',
'@node one node,,,(dir)
Top node

anchor ref @anchor{ref}.

ref to ref @ref{ref}.
'],
['chapter_between_nodes',
'
@node Top
@top top section
Top node

@menu
* section node::
@end menu

@chapter Chapter

In chapter

@node section node,,,Top
@section section

section.

@contents
'],
['part_node_before_top',
'@node part node before top, Top,,Top
@part part

@node Top
@top top

@menu
* part node before top::
@end menu
', {'test_split' => 'section'}],
['part_node_after_top',
'@node Top
@top top

@menu
* part node after top::
@end menu

@node part node after top
@part part
', {'test_split' => 'section'}],
['part_chapter_after_top',
'@node Top
@top top

@menu
* chapter::
@end menu

@part part

@node chapter
@chapter chapter
', {'test_split' => 'section'}],
['part_node_chapter_after_top',
'@node Top
@top top

@menu
* a node after part::
* chapter::
@end menu

@part part

@node a node after part, chapter, Top, Top
After a node after part

@node chapter, a node after part,, Top
@chapter chapter
', {'test_split' => 'section'}],
['node_part_chapter_after_top',
'@node Top
@top top

@menu
* chapter node::
@end menu

@node chapter node
@part part

@chapter chapter
', {'test_split' => 'section'}],
['node_part_chapter_after_chapter',
'@node Top
@top top

@menu
* chapter node::
* part chapter node::
@end menu

@node chapter node

@chapter chapter node

@node part chapter node
@part part

@chapter chapter with part node

@contents
',{'test_formats' => ['plaintext'], 'test_split' => 'section'} ],
['part_node_chapter_appendix',
'@node Top
@top top

@menu
* chapter node::
@end menu

@part Part 1

@node chapter node
@chapter chapter

@appendix Appendix
', {'test_split' => 'section'}],
['part_node_part_appendix',
'@node Top
@top top

@menu
* chapter node::
@end menu

@part Part 1

@node chapter node
@chapter chapter

@part Part Appendix

@appendix Appendix
', {'test_split' => 'section'}],
['part_node_chapter_node_appendix',
'@node Top
@top top

@menu
* chapter node::
* appendix node::
@end menu

@part Part 1

@node chapter node
@chapter chapter

@node appendix node
@appendix Appendix
', {'test_split' => 'section'}],
['part_node_part_node_appendix',
'@node Top
@top top

@menu
* chapter node::
* appendix node::
@end menu

@part Part 1

@node chapter node
@chapter chapter

@part Part Appendix

@node appendix node
@appendix Appendix
', {'test_split' => 'section'}],
['part_node_node_part_appendix',
'@node Top
@top top

@menu
* chapter node::
* appendix part::
@end menu

@part Part 1

@node chapter node
@chapter chapter

@node appendix part
@part Part Appendix

@appendix Appendix
', {'test_split' => 'section'}],
['unnumbered_before_top_node',
'@unnumbered before nodes

@node Top
Top node

@titlefont{Title titlefont}
', {'test_split' => 'section'}],
['unnumbered_before_node_top_top',
'@unnumbered before nodes

in unnumbered

@node Top
@top top section
Top node
', {'test_split' => 'section'}],
['section_before_top',
'@node section node,,,Top
@section section

@node Top
@top top

@menu
* section node::
@end menu
'],
['section_chapter_before_top_nodes',
'@node section node
@section section

@node chapter node
@chapter chapter

@menu
* section node::
@end menu

@node Top
@top top

@menu
* chapter node::
@end menu

'],
['section_node_before_part',
'
@node Top
@section section

@part part
'],
['top_node_part_top',
'@node Top

@part part

@top top
', {'test_split' => 'section'}],
['chapter_node_before_and_after_part',
'
@node Top
@chapter chapter

@menu
* after::
@end menu

@part part

@node after
@chapter chapter 2

@contents
',{'test_formats' => ['plaintext']}],
['section_in_unnumbered_info',
$section_in_unnumbered_text
],
['top_without_node_sections',
$top_without_node_text,
{'test_split' => 'section'}],
['top_without_node_nodes',
$top_without_node_text,
{'test_split' => 'node'}],
['unnumbered_top_without_node_sections',
$unnumbered_top_without_node_text,
{'test_split' => 'section'}],
['unnumbered_top_without_node_nodes',
$unnumbered_top_without_node_text,
{'test_split' => 'node'}],
['space_in_node',
'
@node Top

@menu
* Chap    first here::
* Test    title   :Test   title.
*   Last with spaces    ::
@end menu

@node  Chap first  here

@node Test               title

@node   Last with spaces
'],
['next_in_menu_is_below',
'@node Top
@top top

@menu
* chapter::
@end menu

@node chapter
@chapter chapter

@menu
* section::
* subsection::
@end menu

@node section
@section section

@menu
* subsection::
@end menu

@node subsection
@subsection subsection
'],
['empty_top_node_up',
'@node Top
@top empty top node up

@menu
* first::
@end menu

@node first
',{'TOP_NODE_UP' => ''}
],
['node_up_direction_for_top_with_manual',
'@node Top,,,(dir)top
'],
['internal_top_node_up',
'@node Top
@top internal top node up

@menu
* first::
@end menu

@node first
',{'TOP_NODE_UP' => 'node@@ node', 'test_split' => 'node'}
],
['top_node_up_url',
'@node Top
@top internal top node up

@menu
* first::
@end menu

@node first
',{'TOP_NODE_UP' => '@acronym{GNU, @acronym{GNU}\'s Not Unix} manuals',
   'test_split' => 'node'}, {'TOP_NODE_UP_URL' => 'http://www.gnu.org/manual/'}
],
['non_automatic_top_node_up_url',
'@node Top, first, (dir), (dir)
@top internal top node up

@menu
* first::
@end menu

@node first, , Top, (dir)
',{'test_split' => 'node'},{'TOP_NODE_UP_URL' => 'http://www.gnu.org/manual/'}
],
['non_automatic_internal_top_node_up',
'@node Top, first, @acronym{GNU, @acronym{GNU}\'s Not Unix} manuals, @acronym{GNU, @acronym{GNU}\'s Not Unix} manuals
@top internal top node up

@menu
* first::
@end menu

@node first, , Top, @acronym{GNU, @acronym{GNU}\'s Not Unix} manuals
',{'TOP_NODE_UP' => '@acronym{GNU, @acronym{GNU}\'s Not Unix} manuals',
   'test_split' => 'node'}
],
['non_automatic_top_node_up_and_url',
'@node Top, first, @acronym{GNU, @acronym{GNU}\'s Not Unix} manuals, @acronym{GNU, @acronym{GNU}\'s Not Unix} manuals
@top internal top node up

@menu
* first::
@end menu

@node first, , Top, @acronym{GNU, @acronym{GNU}\'s Not Unix} manuals
',{'TOP_NODE_UP' => '@acronym{GNU, @acronym{GNU}\'s Not Unix} manuals',
  'test_split' => 'node'},
  {'TOP_NODE_UP_URL' => 'http://www.gnu.org/manual/'}
],
['protected_node_parentheses',
'
@node Top
@top top

@menu
* @asis{(}manual) name::
@end menu

@node @asis{(}manual) name

@anchor{@asis{(}manual2) name2}

@ref{@asis{(}manual2) name2}.
'],
);

my $complex_case = '@node Top,First node,(dir)
@top
@menu
* First node::
* between node::
* Second node::   node 2
* Third node unnumbered:: unnumbered in Top menu
* continuity::
* Last node no description::
@end menu

@node First node,,Top,Top
@chapter first node chapter

first node chapter text
@menu
* unnumbered:: un
* unnumbered2:: un2
* numbered:: nu

@end menu

@node unnumbered
@unnumberedsec unnumbered section

@menu
* unnumbered sub:: un
* numbered sub:: nu
* unnumbered sub2:: un2
* numbered sub2:: nu2
@end menu

@node unnumbered sub
@unnumberedsubsec unnumbered subsection

@node numbered sub
@subsection numbered subsection

@node unnumbered sub2
@unnumberedsubsec unnumbered subsection2

@node numbered sub2
@subsection numbered subsection2

@node unnumbered2
@unnumberedsec unnumbered section2

@menu
*  numbered sub3::
@end menu

@node numbered sub3
@subsection numbered subsection3

@node numbered
@section  numbered section

@node between node,,,Top

between node, node without sectioning node

@node Second node,Third node unnumbered,,Top

Second node text

@chapter second node chapter

second node chapter text.

@node Third node unnumbered
@unnumbered unnumbered chapter

unnumbered chapter text.

@node continuity,  Third node unnumbered, Last node no description, Top
@unnumbered unnumbered continuity

Unumbered and node needed for continuity between automatic
directions and lone node.

@node Last node no description,,continuity,Top

@contents
@bye
';

my @test_cases = (
['node_too_much_args',
'@node Top, , , , (dir)'
],
[ 'node',
'
@node one arg1
@node one arg2, two arg
@node one arg3, two arg, three arg
@node one arg4, two arg, three arg, four arg
@node one arg5, two arg, three arg, four arg, five arg

@node comment @comment

@node arg1 @comma{} arg2, @,cedilla, @strong{comma in strong,} @c comma , end
'],
['empty_nodes_with_commands',
'
@node @c comment

@node @
@node @:
@node @asis{ }
'],
['empty_refs',
'@xref{@:}.
@xref{@asis{ }}.
'],
['at_commands_in_node',
'@node A @sc{sc} node @"i @"{@dotless{i}} @`{@=E} @l{} @,{@\'C} @exclamdown{}'
],
['email_in_node',
'@node @email{ a } @email{c , d} @email{ , e}
'],
['sections',
'@chapter a chapter
'],
['unnumbered_no_argument',
'@unnumbered
'],
['a_comma_after_node',
'@node Commands, Requirements, Nodes and Menus

A comma in text, end.
'],
['nodename_parentheses',
'@node Top
@top The top node

@menu
* Node (with parentheses)::
* Other node::
* (manual)node::
@end menu

@node Node (with parentheses)
@chapter Section (nodename with parentheses)

Dummy section

@node Other node
@chapter Section (nodename without parentheses)

Dummy link to @ref{Node (with parentheses)}.

Dummy link to @ref{(manual)node}.

@node (manual)node
@chapter (manual)node

Dummy section with (manual)node node syntax.

@anchor{(manual)anchor}.

'],
['node_nested_parentheses',
'@node Top

@menu
* ((some) file)::
* (other (file))node name::
* (@code{open(}) close)::
* (@code{)))} error::
@end menu
'],
['node_empty_direction',
'@node name, '
],
['unknown_node_in_menu',
'@node Top

@menu
* unknown::
@end menu
'],
['ref_to_unknown_node',
'@xref{unknown node}.'],
['raiselowersections',
'\input texinfo @c -*-texinfo-*-

@node Top
@top
@menu
* Chapter::
* Second chapter::
@end menu

@node Chapter
@chapter Chapter

@menu
@ifclear include
* Chapter in included file::
@end ifclear
@end menu

@set do-top

@lowersections

@ifclear include
@include section_file.texi
@end ifclear
@raisesections

@clear do-top

@node Second chapter
@chapter Second chapter

Second chapter

@contents
@bye
'],
['empty_node',
'@node

@node , next, prev, up
'],
['empty_anchor',
'@anchor{}.
@anchor{   }.
'],
['double_top_in_menu',
'@node ToP, top
Top node

@menu
* top::
* TOP:: myself
@end menu

@node top,,ToP,Top
second node.
'],
['rec_nodes',
'@node Top
Top node

@menu
* second node::
* node following second::
@end menu

@node second node,,Top,Top

@menu
* other node::
* second node::
@end menu

@node other node,,,second node

@menu
* other node::
@end menu

@node node up node following second,,,node following second
@menu
* node following second::
@end menu

in node up node following second

@node node following second,,,node up node following second

in node following second
@menu
* node up node following second::
@end menu
'],
['semi_auto',
'@node Top
@top Top

@menu
* Chap1::
* Section non auto::
@end menu

@node Chap1
@chapter Chapter 1

@menu
* Sec in chapter::
@end menu

@node Sec in chapter
@section Sec in chapter

@node Section non auto,, Chap1, Top
@section Section
'],
['next_no_prev_to_node',
'@node Top

@menu
* first node::
* no return::
@end menu

@node first node, no return,, Top

@node no return,,, Top
'],
['novalidate',
'
@novalidate

@node first, unknown node

@menu
* not a node::
@end menu

@xref{unknown ref}.
'],
['loop_nodes',
'
@node Top
@top top

@menu
* node up::
@end menu

@node node up,,,node down

@menu
* node middle::
@end menu

@node node middle,,,node up

@menu
* node down::
@end menu

@node node down
'],
['complex',
$complex_case,
{'test_split' => 'section'}
],
['complex_split_at_node',
$complex_case,
{'test_split' => 'node'}
],
['double_top_section',
'@top First top

First top.

@top Second top

Second top.
'],
['unnumbered_before_top',
'@unnumbered before top

@top top
'],
['hole_in_sectioning',
'@top Top

@chapter Chapter

@section section

@subsubsection subsubsection with no subsection above

@subsection the subsection
'],
['lone_Top_node',
'@node Top

@menu
* First::
@end menu

@node First
@chapter chap
', {'test_split' => 'section'}
],
['lowered_subsubsection',
'@node Top
@top

@menu
* Chapter::
@end menu

@node Chapter
@chapter Chapter

@menu
* Section::
@end menu

@node Section
@section Section

@menu
* Subsection::
@end menu

@node Subsection
@subsection Subsection

@menu
* Subsubsection::
* Lowered subsec::
@end menu

@node Subsubsection
@subsubsection Subsubsection

@lowersections
@node Lowered subsec
@subsection Lowered subsec

@menu
* Lowered subsubsection::
@end menu

@node Lowered subsubsection
@subsubsection Lowered subsubsection
@raisesections

@contents
@bye
'],
['loweredheading',
'@lowersections
@section Foo
@heading Bar
@bye
'],
['menutextorder',
'@menu
* foo::
* bar::
@end menu

@node bar
@chapter bar

@menu
* onesub2::
@end menu

@node onesub1
@section One sub 1

@node onesub2
@section One sub 2

@node foo
@chapter foo

@menu
* sub1::
* sub3::
* sub2::
@end menu

@node sub1
@section Sub1

@node sub2
@section Sub2

@node sub3
@section Sub3
'],
['nodes_before_top',
'@node first, Top, ,(dir)

@menu
* node in menu before top::
@end menu

@node node in menu before top,,,first

@node Top,,first
@top top section

@menu
* second node::
@end menu

@node second node
@chapter a chapter
'],
['part_before_section',
'@part part

@section section
', {'test_split' => 'section', 'test_formats' => ['html_text']}
],
['section_before_chapter',
'@section section

@chapter chapter
'],
['top_part_chapter',
'@top top

@part part

@chapter chapter
', {'test_split' => 'section'}],
['section_before_top_no_node',
'@section section

@top top
'],
['section_chapter_before_top',
'@section section

@chapter chapter

@top top
'],
['part_chapter_appendix',
'
@part Part 1

@chapter chapter

@appendix Appendix
'],
['sectioning_part_appendix',
$test_text,
{'test_split' => 'section'}],
['sectioning_part_appendix_no_top',
$sections_no_top_text,
{'test_split' => 'section'}],
['chapter_sections',
$chapter_sections_text,
{'test_split' => 'section'}],
['top_chapter_sections',
$top_chapter_sections_text,
{'test_split' => 'section'}],
['contents_in_html_text',
'@top top

@chapter Chap1

@section Sec 1

@chapter Chap2

@shortcontents
@contents
', {'test_formats' => ['html_text']}
],
['more_sections_than_nodes',
'@node Top
@top top

@menu
* n c2::
* n c3::
* n c3 s1 s2::
@end menu

@chapter c1

@node n c2
@chapter c2

@section s1

@node n c3, n c3 s1 s2, n c2, Top
@chapter c3

@menu
* n c3 s 2::
@end menu

@section C3 s1

@node n c3 s 2
@section c3 s2

@section c3 s3

@chapter c4

@section c3 s1

@subsection c3 s1 s1

@node n c3 s1 s2,,n c3,Top
@subsection c3 s1 s2

@appendix appendix
'],
['empty_ref_arg',
'@node Top

@ref{Top, @ }
@ref{Top, , @ }
@ref{Top, @ , @:}
@ref{Top, @c aaa
 @
@c ggg
, @c fff
@c
}
'
],
['no_menu',
'@node Top
@top

@node c1
@chapter c1

@node c2
@chapter c2

@node c3
@chapter c3
', {'test_formats' => ['info', 'html']}
],
['contents_at_document_begin',
undef, {'test_file' => 'contents_at_document_begin.texi'}],
['contents_at_end_document_after_node',
undef, {'test_file' => 'contents_at_end_document_after_node.texi'}],
['contents_at_end_document',
undef, {'test_file' => 'contents_at_end_document.texi'}],
['contents_in_document',
undef, {'test_file' => 'contents_in_document.texi'}],
['contents_no_section',
undef, {'test_file' => 'contents_no_section.texi'}],
);

my @test_out_files = (
['transliterated_split_equivalent_nodes',
'@node Top

@menu
* @~a::
* n::
* @^a::
@end menu

@node @~a

@node n

@node @^a
', {'test_split' => 'node'}],
['character_and_spaces_in_refs_out',
$character_and_spaces_in_refs_text,
{'test_split' => 'node'}]
);

foreach my $test (@test_out_files) {
  push @{$test->[2]->{'test_formats'}}, 'file_html';
  $test->[2]->{'test_input_file_name'} = $test->[0] . '.texi';
}

my @xml_tests_converted_tests = ('section_before_part', 'chapter_before_part',
  'part_before_top', 'double_part', 'section_in_unnumbered_plaintext',
  'two_unnumbered_no_argument', 'two_nodes_between_chapters',
  'chapter_before_and_after_part');

foreach my $test (@tests_converted) {
  push @{$test->[2]->{'test_formats'}}, 'plaintext';
  push @{$test->[2]->{'test_formats'}}, 'html';
  push @{$test->[2]->{'test_formats'}}, 'xml'
    if (grep {$_ eq $test->[0]} @xml_tests_converted_tests);
}

my @xml_tests_info_tests = ('part_chapter_after_top',
  'part_node_after_top', 'part_node_before_top',
  'chapter_between_nodes', 'nodes_no_node_top_explicit_directions',
  'part_node_chapter_after_top', 'node_part_chapter_after_top',
  'node_part_chapter_after_chapter', 'section_before_top',
  'section_node_before_part', 'top_node_part_top',
  'chapter_node_before_and_after_part',
  'more_nodes_than_sections', 'part_node_chapter_appendix',
  'part_node_part_appendix', 'part_node_chapter_node_appendix',
  'part_node_part_node_appendix', 'part_node_node_part_appendix',
  'explicit_node_directions', 'nodes_after_top_before_chapter_nodes',
  'double_node_anchor_float');

my @docbook_tests_info_tests = ('double_node_anchor_float');

foreach my $test (@tests_info) {
  push @{$test->[2]->{'test_formats'}}, 'info';
  push @{$test->[2]->{'test_formats'}}, 'html';
  push @{$test->[2]->{'test_formats'}}, 'xml'
    if (grep {$_ eq $test->[0]} @xml_tests_info_tests);
  push @{$test->[2]->{'test_formats'}}, 'docbook'
    if (grep {$_ eq $test->[0]} @docbook_tests_info_tests);
}

my @xml_tests_cases_tests = ('part_before_section',
'section_before_chapter',
'top_part_chapter', 'section_before_top_no_node',
'section_chapter_before_top', 'sectioning_part_appendix',
'part_chapter_appendix', 'sectioning_part_appendix_no_top',
'top_chapter_sections', 'chapter_sections',
'more_sections_than_nodes');
foreach my $test (@test_cases) {
  push @{$test->[2]->{'test_formats'}}, 'xml'
    if (grep {$_ eq $test->[0]} @xml_tests_cases_tests);
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('sectioning', [@test_cases, @tests_converted,
                        @test_out_files, @tests_info], $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
[ 'simple', '@set a-_5b the value @b{b} @c comment

@value{a-_5b} After value.
'],
['not_only_characters',
'@set -e_\'::; hh

Say @value{-e_\'::;}.
'],
['bad_syntax','
@set
@set
@set ?
@set :-/ hey!
@set a@b
@set :-" bad
@set } no

@clear aaa ggg
@clear and{other

@value{gurgl

@value{unknown}
'],
['spaces_before_value',
'@set var val

@value  {var}
'],
['comment_on_set_line',
'@set x@c
@set y @c
@set z g@c
@set t a vv @comment@ggg

!@value{x}!, !@value{y}!, !@value{z}!, !@value{t}!
'],
['value_zero',
'@set zero 0
Value
@value{zero}'
],
['empty_set',
'@set myspace

1 @value{myspace} 1
'],
['empty_value_in_line',
'@set myspace

1
@value{myspace}
1
'],
['value_in_node',
'@set node1 Node 1

@node Top, (dir), (dir), (dir)
@top Expansion in Node Names

@menu
* @value{node1}  ::
@end menu

@node @value{node1},, Top, Top
@chapter Chapter 1

@set sec1 Section 1.1

@menu
* @value{sec1}::
@end menu

@node Section 1.1, , Node 1, Node 1

@xref{@value{node1}}.
'],
['value_node_directions',
'@set a--foo bar

@node Top, @value{a--foo}, (dir), (dir)
@top Var @value{a--foo}
@value{a--foo}

@node @value{a--foo}, BarFoo, Top, (dir)
@chapter BarFoo

@node BarFoo, , @value{a--foo}, (dir)
@chapter bar
'],
['value_after_accent',
'@set a_letter a
@ringaccent @value{a_letter}
@~@value{a_letter}'
],
['value_in_index_commands',
'@set cp cp
@set fn fn
@set syncodeindex_command @syncodeindex

@syncodeindex @value{cp} @value{fn}
@value{syncodeindex_command} cp fn

@set truc truc

definedx truc
@defindex @value{truc}
after

@set trucindex_command @trucindex

@set codeidx codeidx

@defcodeindex @value{codeidx}

@set defcodeindex_entry a @var{index entry} t@\'e @^{@dotless{i}}

@node Top

@value{trucindex_command} index truc

@codeidxindex @value{defcodeindex_entry}

@kindex @value{truc} kindex
@pindex pindex @value{codeidx}

value truc
@printindex @value{truc}

value cp
@printindex @value{cp}
'],
['value_in_misc_commands',
'@set text atext

@node Top
@top top @value{text}
@subheading Comment like: @value{text}

Text line followed by a comment on the same line and another below @c comment @value{text}
@c comment @value{text}

@set pagesizes_arg 200mm,150mm
@set afourpaper_macro @afourpaper

@ifnottex
@pagesizes @value{pagesizes_arg}
@end ifnottex
@value{afourpaper_macro}
@headings on line following headings @value{text}
@oddfooting some text ignored @value{text}
@everyheading on line following everyheading @value{text}

@set need_arg 0.1

@ifnottex
@need @value{need_arg}
@end ifnottex

@set raisesections_macro @raisesections
@value{raisesections_macro}
@set lowersections_macro @lowersections
@value{lowersections_macro}

@c tex error: Use of \ doesn\'t match its definition.
@ifnottex
@@definfoenclose phoo,//,\\\\  @definfoenclose phoo,//,\\\\

@phoo{bar}
@end ifnottex

@set definfoenclose_name phi
@definfoenclose @value{definfoenclose_name},:,:

@phi{bar}

@set strong_macro @strong
@set strong_name strong

@value{strong_macro}{very strong}

@definfoenclose @value{strong_name},(@value{strong_name}:,:)

@value{strong_macro}{ is it really strong? }

@kbd{something before kbdinputstyle}

@set kbdinputstyle_arg code
@kbdinputstyle @value{kbdinputstyle_arg}

@kbd{truc}

@example
@kbd{example}
@end example

@set asis_arg asis
@set zero 0
@set none_arg none
@set four 4
@set six 6

@paragraphindent @value{asis_arg}
@paragraphindent @value{zero}
@paragraphindent @value{none_arg}
@paragraphindent @value{four}
@firstparagraphindent @value{none_arg}
@exampleindent @value{six}

@set end_arg end
@set separate_arg separate
@footnotestyle @value{end_arg}
@footnotestyle @value{separate_arg}

@set latin1 ISO-8859-1
@documentencoding @value{latin1}

@set en en
@set documentlanguage_command @documentlanguage

documentlanguage @documentlanguage  @value{en}

documentlanguage on its line
@value{documentlanguage_command}  en
line following documentlanguage

@set on_arg on
@set off_arg off
@frenchspacing @value{on_arg}
@frenchspacing @value{off_arg}

@c accepts 10 or 11
@set ten 10
@fonttextsize @value{ten}

@c accept false or true
@c makeinfo don\'t care about the arg and remove the remaining of the line
@set false_arg false
@set true_arg true
@allowcodebreaks @value{false_arg}

@allowcodebreaks @value{true_arg}

@set page_macro @page
@set noindent_macro @noindent
@set refill_macro @refill

@@page @value{page_macro} @@noindent @value{noindent_macro} @@refill @value{refill_macro} something

@value{noindent_macro}     noindent at beginning of line
@value{noindent_macro}
noindent on the preceding line
  @value{noindent_macro}    noindent after space at beginning of line
@page         page at beginning of line
@page
After page on it\'s own line.

@@page @value{page_macro}   @@noindent @value{noindent_macro}    @@refill @value{refill_macro}

@set contents_macro @contents
@value{contents_macro}

@vskip @value{text}

@set cropmarks_command @cropmarks
@value{cropmarks_command}

@set exdent_macro @exdent
@value{exdent_macro} line after exdent

@set two 2
@sp @value{two}

@set result_macro @result

@clickstyle @value{result_macro}

@value{contents_macro}

@set shortcontents_macro @shortcontents
@value{shortcontents_macro}

@set bye_macro @bye

@value{bye_macro}',
{'expanded_formats' => []}
],
['value_in_invalid_documentencoding',
'@set badvalue bad
@documentencoding @value{badvalue}
'],
['set_flag_command_equivalent',
'@set txicodequoteundirected

@value{txicodequoteundirected}.

@clear txicodequoteundirected
'],
['set_on_item_line',
'@table @code
@item @set a b@c
item text
in item
@item jj @set j@c
line
@item vvv @set g@c
@end table

@table @code
@item @set a b
item text
in item
@item jj @set j
line
@item vvv @set g
@end table
'],
['set_in_item_missing_line',
'@table @code
@item xx @set n
@item jj
@end table

@table @code
@item xx @set n@c
@item jj
@end table
'],
['set_form_feed',
'@set gg  a\\a\\f\\\\
@set hh
@set ll

@code{@value{gg}. @value{hh}. @value{ll}}.
', {'test_formats' => ['xml']}
],
['ignored_value_definition',
'@set aa outside

@inlinefmt{tex,
@set aa in inlinefmt tex
}

@value{aa}.
']
);

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('value', \@test_cases, $arg_test_case,
   $arg_generate, $arg_debug);


code:
use strict;

use File::Spec;
BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }

require 't/test_utils.pl';

my @test_cases = (
[ 'not_set',
'@ifset a

Flag a is set.

@end ifset
'],
['comment_on_ifset_line',
'@set x

@ifset x@c
Y1
@end ifset
@ifset x@c comm
Y2
@end ifset
@ifset x@c@ggg
Y3
@end ifset
@ifset x @c
Y4
@end ifset
@ifset x @c comm
Y5
@end ifset
@ifset x @c@ggg
Y6
@end ifset
'],
['nested_ignore',
'@ignore
@ignore

@end ignore

@ignore
@end iftex
@ifinfo
@end ignore

@ignore
@end ifclear
@ifclear
@end ignore
'],
['empty_set_in_ifset',
'@set a

@ifset a
a is set to:|@value{a}|.
@end ifset'
],
['empty_set_in_ifclear',
'@set a

@ifclear a
a is set to:|@value{a}|.
@end ifclear'
],
['consecutive_conditionals',
'@ifinfo
in ifinfo
@end ifinfo
@iftex
in iftex
@end iftex

@set b

@ifclear b
in ifclear
@end ifclear
@ifset a
in ifset
@end ifset
'],
['ifnot_format_conditional',
'@ifnottex
not tex
@end ifnottex

After.'],
['many_conditionals',
'@html
This is html text.
@end html

@ifhtml
This is ifhtml text.
@end ifhtml

@ifnothtml
This is ifnothtml text.
@end ifnothtml

@ifinfo
This is ifinfo text.
@end ifinfo

@ifnotinfo
This is ifnotinfo text.
@end ifnotinfo

@tex
This is tex text.
@end tex

@iftex
This is iftex text.
@end iftex

@ifnottex
This is ifnottex text.
@end ifnottex
', { 'expanded_formats' => ['info', 'html'] }],
['commands_in_ifset',
'
@ifset notset
@definfoenclose
@documentencoding ISO-8859-1
@end ifsettruc
open {
@end ifset

@ifset notset
@example
@copying
@itemize
@table
@bye
@end ifset
'],
['ifset_in_command',
'
@file{
@ifset x
xset
@end ifset
@ifclear x
xclear
@end ifclear
}
'],
['ignored_in_ifset',
'
@ifset notset
@ignore
@end ifset
@end ignore
text
@end ifset

@ifset notset
@verbatim
@end ifset
@end verbatim
@end ifset

@ifset notset
@verb{%
@end ifset
%}
@end ifset
'],
['empty_ifset_in_ifset_no_set',
'
@ifset notset
@verbatim
@ifset
@end verbatim
@end ifset
'],
['ifclear_in_ifset',
'
@ifset a
@ifclear ok  - ok, ignored
@end junky   - ok, ignored
@end ifset
@c WRONG - missing @end ifset.
'],
['ifclear_in_ifset_set',
'
@set a

@ifset a
@ifclear ok @c - ok, ignored
@end junky   - ok, ignored
@end ifset
@c WRONG - missing @end ifset.
'],
['nested_ifset_ifclear',
'
@macro conditionals{}
@ifset somevar
@ifset anothervar
Both somevar and anothervar are set.
@end ifset
@ifclear anothervar
Somevar is set, anothervar is not.
@end ifclear
@end ifset
@end macro

@set somevar
@set anothervar
@conditionals{}

@set somevar
@clear anothervar
@conditionals{}

@clear somevar
@set anothervar
@conditionals{}

@clear somevar
@clear anothervar
@conditionals{}
'],
['end_ifset_in_format',
'
@set notset

@ifset notset
@ignore
@end ifset
@end ignore
text
@end ifset

@ifset notset
@verbatim
@end ifset
@end verbatim
@end ifset

@ifset notset
@verb{%
@end ifset
%}
@end ifset
'],
['empty_ifset_in_ifset_set',
'
@set notset

@ifset notset
@verbatim
@ifset
@end verbatim
@end ifset
'],
['macro_in_ifset',
'
@macro truc {}
truc
@end macro

@ifset a
@unmacro truc
@macro truc{}
in ifset
@end macro
@end ifset

@truc{}
'],
['macro_in_ifset_set',
'
@set a

@macro truc {}
truc
@end macro

@ifset a
@unmacro truc
@macro truc{}
in ifset
@end macro
@end ifset

@truc{}
'],
['empty_ifclear',
'@ifclear

Something

@end ifclear
'],
['empty_ifset',
'@ifset

Something

@end ifset
'],
['bad_ifset_argument',
'@ifset a|b
Ra&b
@end ifset
'],
['bad_ifclear_argument',
'
@ifclear #something
R#something
@end ifclear
'],
['ignore_not_closed',
'@ignore

This is ignored
'],
['info_ifplaintext',
'
@ifplaintext
this text will only appear in plain text.
@end ifplaintext
', {'expanded_formats' => ['info']}
],
['plaintext_ifinfo',
'
@ifinfo
this text will appear only in Info and plain text.
@end ifinfo
', {'expanded_formats' => ['plaintext']}
],
['ifnotinfo_exception',
'@ifnotinfo
in ifnotinfo
@end ifnotinfo
', {'expanded_formats' => ['plaintext']}
],
['info_ifinfo_ifnotplaintext',
'@ifinfo
@ifnotplaintext
This will be in Info, but not plain text.
@end ifnotplaintext
@end ifinfo
', {'expanded_formats' => ['info']}
],
['plaintext_ifinfo_ifnotplaintext',
'@ifinfo
@ifnotplaintext
This will be in Info, but not plain text.
@end ifnotplaintext
@end ifinfo
', {'expanded_formats' => ['plaintext']}
],
['text_on_conditional_line_expanded',
'@ifnothtml text following ifnothtml,
a
@end ifnothtml
'
],
['text_on_conditional_line',
'@ifnothtml text following ifnothtml,
a
@end ifnothtml
', {'expanded_formats' => ['html']}
],
['additional_space_in_end_conditional',
'@ifnothtml
not html
@end  ifnothtml
', {'expanded_formats' => ['html']}
],
['additional_space_in_end_conditional_expanded',
'@ifnothtml
not html
@end  ifnothtml
'],
['superfluous_argument_to_end',
'@ifnothtml
not html
@end ifnothtml superfluous
'],
['conditional_not_closed',
'@ifhtml
in ifhtml
'],
['end_conditional_not_at_line_begining',
'@ifhtml
inhtml
  @end ifhtml
'],
['command_conditionals',
'@ifset txicommandconditionals
Good, the txicommandconditionals variable was set.
@end ifset

@ifcommanddefined nodexyz
Bad, @@nodexyz is defined.
@end ifcommanddefined
@ifcommandnotdefined nodexyz
Good, @@nodexyz is not defined.
@end ifcommandnotdefined

@ifcommanddefined node
Good, @@node is defined.
@end ifcommanddefined
@ifcommandnotdefined node
Bad, @@node is not defined.
@end ifcommandnotdefined

@ifcommanddefined mathcode
Unfortunately, @@mathcode is defined.
@end ifcommanddefined
@ifcommandnotdefined mathcode
Happily, @@mathcode is not defined.
@end ifcommandnotdefined
'],
['command_conditionals_user_defined',
'@macro truc
machin
@end macro

@defindex auth

@definfoenclose infoencl, :,:

@alias strongalias = strong

@ifcommanddefined truc
@@macro truc is defined.
@end ifcommanddefined
@ifcommandnotdefined truc
@@macro truc is wrongly not defined
@end ifcommandnotdefined

@ifcommanddefined authindex
index command @@authindex is defined.
@end ifcommanddefined
@ifcommandnotdefined authindex
index command @@authindex is wrongly not defined
@end ifcommandnotdefined

@ifcommanddefined infoencl
definfoenclose @@infoencl is defined.
@end ifcommanddefined
@ifcommandnotdefined infoencl
definfoenclose @@infoencl is wrongly not defined
@end ifcommandnotdefined

@ifcommanddefined strongalias
strongalias @@alias is defined.
@end ifcommanddefined
@ifcommandnotdefined strongalias
strongalias @@alias is wrongly not defined
@end ifcommandnotdefined
'],
);

for my $test (@test_cases) {
  if (!defined $test->[2]->{'expanded_formats'}) {
    $test->[2]->{'expanded_formats'} = [];
  }
}

our ($arg_test_case, $arg_generate, $arg_debug);

run_all ('conditionals', \@test_cases, $arg_test_case,
   $arg_generate, $arg_debug);