File: backcompat.t

package info (click to toggle)
libjson-validator-perl 4.14%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 828 kB
  • sloc: perl: 2,816; makefile: 14
file content (19 lines) | stat: -rw-r--r-- 606 bytes parent folder | download
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;