summaryrefslogtreecommitdiffstats
path: root/t/002-expressions.t
blob: afe66d89547869c4fed83e3002916a2e61779c95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use strict;
use warnings;
use Test::More;
use Text::Xslate;

my $tx = Text::Xslate->new(syntax => 'Handlebars');

is(
    $tx->render_string(
        '<h1>{{title}}</h1>',
        { title => 'Xslate rocks' },
    ),
    '<h1>Xslate rocks</h1>',
);

is(
    $tx->render_string(
        '<h1>{{article.title}}</h1>',
        { article => { title => 'Hash references rock' } },
    ),
    '<h1>Hash references rock</h1>',
);

is(
    $tx->render_string(
        '<h1>{{article/title}}</h1>',
        { article => { title => 'Deprecated syntax does not' } },
    ),
    '<h1>Deprecated syntax does not</h1>',
);

done_testing;