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

plan 2;

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,
    defaults => %(
        variable => 'Simple Variable',
        space => %(
            inside => 'A variable inside a space.'
        )
    ),
);

my %simple-page = %(
    TEMPLATE => '00-simple-page',
    simple_component => %(
        TEMPLATE => '01-simple-component',
        variable => 'Simple Variable in Simple Component'
    )
);
is(
    $nest.render(%simple-page),
    $output-dir.add('01-simple-page.html').slurp,
    "Simple template is rendered with defaults."
);

my %space-page = %( TEMPLATE => '03-namespace-page' );
is(
    $nest.render(%space-page),
    $output-dir.add('11-namespace-page.html').slurp,
    "Simple template is rendered with default namespaced char."
);


