### ----------------------------------------------------
### -- Template::Nest::Fast
### -- Licenses: ISC
### -- Authors: Andinus <andinus@nand.sh>
### -- File: t/03-show-labels.rakutest
### ----------------------------------------------------
use Test;
use Template::Nest::Fast;

plan 3;

my IO $output-dir = $*PROGRAM.IO.parent.add('output');
my IO $template-dir = $*PROGRAM.IO.parent.add('templates');

my $nest = Template::Nest::Fast.new( :$template-dir, :show-labels );

my $nest-alt = Template::Nest::Fast.new( # checking if alt delim works.
    :$template-dir, :show-labels, comment-delims => ['<!--!', '!-->']
);

my $nest-alt-underscored = Template::Nest::Fast.new( # checking if underscored options work.
    :$template-dir, :show_labels, comment_delims => ['<!--!', '!-->']
);

my %simple-page = %(
    TEMPLATE => '00-simple-page',
    variable => 'Simple Variable',
    simple_component => %(
        TEMPLATE => '01-simple-component',
        variable => 'Simple Variable in Simple Component'
    )
);

# render test with show-labels True.
is(
    $nest.render(%simple-page),
    $output-dir.add('04-simple-page-with-labels.html').slurp,
    "Simple template is rendered with show-labels = True."
);

is(
    $nest-alt.render(%simple-page),
    $output-dir.add('05-simple-page-with-labels-alt-delims.html').slurp,
    "Simple template is rendered with show-labels = True and alternate comment delims."
);

is(
    $nest-alt-underscored.render(%simple-page),
    $nest-alt.render(%simple-page),
    "Simple template is rendered underscored options."
);


