1# Run the appropriate tests from https://github.com/ingydotnet/yaml-spec-tml
2use strict;
3use warnings;
4use lib 't/lib';
5use Test::More 0.88;
6use SubtestCompat;
7use TestBridge;
8use TestUtils;
9
10my $JSON = json_class()
11    or Test::More::plan skip_all => 'no JSON backends available!?';
12
13diag 'using JSON backend: ' . $JSON . ' ' . $JSON->VERSION
14    if not $ENV{PERL_CORE};
15
16# Each spec test will need a different bridge and arguments:
17my @spec_tests = (
18    ['t/tml-spec/basic-data.tml', 'test_yaml_json', $JSON],
19    # This test is currently failing massively. We use LAST to only run what is
20    # covered so far.
21    ['t/tml-spec/unicode.tml', 'test_code_point'],  # uses JSON::PP
22);
23
24for my $test (@spec_tests) {
25    my ($file, $bridge, @args) = @$test;
26    my $code = sub {
27        my ($file, $blocks) = @_;
28        subtest "YAML Spec Test; file: $file" => sub {
29            my $func = \&{$bridge};
30            $func->($_) for @$blocks;
31        };
32    };
33    run_testml_file($file, $code, @args);
34}
35
36done_testing;
37