The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
use Test::More;

use strict;
use warnings;

use Template::Mustache;

sub render_ok(@) {
    my $mustache = Template::Mustache->new( template => shift );
    is $mustache->render( shift ), shift, shift;
}

render_ok @$_ for (
    [ "Hello {{planet}}", {planet => "World!"}, 'Hello World!' ],
    [ "{{a}} and {{b}}", {a => 'this', b => 'that' }, 'this and that' ],
    [ "{{c-d}} and {{e.f}}", {'c-d' => 'this', 'e' => { f => 'that' } }, 'this and that' ],
    [ '123{{! no }}456', {}, '123456', 'comment' ],
    [ q(Begin
{{!
    blah blah
}}
{{!  blah blah }}
End), {}, "Begin\nEnd", "standalone comment" ],
);

done_testing;