LaTeX Generator/latex is balanced [ System tests ]

FUNCTION

This function tests whether a generated latex file is balanced or not. That is every

     /begin{xxx} 

should end with a

     /end{xxx}

at the same level.

This is tested with several headers and in different modes.

SOURCE

{
    my @sources = ( \$dummy_header_1, \$dummy_header_2 );

    foreach my $source_ref ( @sources ) {
        foreach my $mode_1 qw( --sections --toc --index ) {
            foreach my $mode_2 qw( --nopre --altlatex ) {
                mkdocdir();
                add_source( "test.c", $$source_ref );
                my ( $out, $err ) = runrobo(
                    qw(--src Src
                    --doc Doc/test
                    --singledoc
                    --latex
                    ), $mode_1, $mode_2 );
                # expected results:
                is( $out, '', 'No ouput' );
                is( $err, '', '... and no error' );
                file_exists_ok( "Doc/test.tex", 'there should be documentation' );
                is( is_latex_balanced( "Doc/test.tex" ), 1, 'latex is balanced' );
                clean();
            }
        }
    }
}