summaryrefslogtreecommitdiffstats
path: root/t/mustache-spec.t
blob: 3713abcabc4a9b451e02e79c4e30538d2eaaf5a6 (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
#!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use Test::Handlebars;

use Test::Requires 'JSON', 'Path::Class';

for my $file (dir('t', 'mustache-spec', 'specs')->children) {
    next unless $file =~ /\.json$/;
    next if $file->basename =~ /^~/; # for now
    next if $file->basename =~ /partials/;
    my $tests = decode_json($file->slurp);
    note("running " . $file->basename . " tests");
    for my $test (@{ $tests->{tests} }) {
        local $TODO = "unimplemented"
            if $file->basename eq 'delimiters.json'
            && $test->{name} =~ /partial/i;

        render_ok(
            $test->{template},
            $test->{data},
            $test->{expected},
            "$test->{name}: $test->{desc}"
        );
    }
}

done_testing;