1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
use Test::More;
use JSON::Validator;
package JSON::Validator::L01;
use Mojo::Base 'JSON::Validator';
has version => 42;
package main;
my $legacy = JSON::Validator::L01->new;
is $legacy->version, 42;
my @errors = eval { $legacy->schema({properties => {foo => {type => 'integer'}}})->validate({foo => '42'}); };
ok !$@, 'did not fail' or diag $@;
like "@errors", qr{Expected integer}, 'correct validation';
like ref($legacy->schema), qr{JSON::Validator::Schema::Backcompat}, 'correct schema class';
isa_ok $legacy->schema, 'JSON::Validator::L01';
isa_ok $legacy->schema, 'JSON::Validator';
done_testing;
|