| 1 |
# vim: set ft=perl ts=8 sts=2 sw=2 tw=100 et : |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
no if "$]" >= 5.031009, feature => 'indirect'; |
| 5 |
|
| 6 |
# this line is only needed of Test::JSON::Schema::Acceptance is not installed (we will need to find |
| 7 |
# the test suite data in the local share/) |
| 8 |
use Test::File::ShareDir -share => { -dist => { 'Test-JSON-Schema-Acceptance' => 'share' } }; |
| 9 |
|
| 10 |
use Test2::Tools::Basic; |
| 11 |
use Test::JSON::Schema::Acceptance; |
| 12 |
use lib 't/lib'; |
| 13 |
use SchemaParser; |
| 14 |
|
| 15 |
my $accepter = Test::JSON::Schema::Acceptance->new( |
| 16 |
specification => 'draft2020-12', |
| 17 |
verbose => 1, |
| 18 |
include_optional => 1, |
| 19 |
); |
| 20 |
|
| 21 |
my $parser = SchemaParser->new; |
| 22 |
$accepter->acceptance( |
| 23 |
validate_data => sub { |
| 24 |
my ($schema, $input_data) = @_; |
| 25 |
return $parser->validate_data($input_data, $schema); |
| 26 |
}, |
| 27 |
); |
| 28 |
|
| 29 |
Test2::Tools::Basic::done_testing; |