File: jv-allof.t

package info (click to toggle)
libjson-validator-perl 3.06%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 616 kB
  • sloc: perl: 1,308; makefile: 6
file content (20 lines) | stat: -rw-r--r-- 563 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use lib '.';
use t::Helper;

my $schema
  = {allOf =>
    [{type => 'string', maxLength => 5}, {type => 'string', minLength => 3}]
  };

validate_ok 'short', $schema;
validate_ok 12, $schema, E('/', '/allOf Expected string - got number.');

$schema
  = {allOf =>
    [{type => 'string', maxLength => 7}, {type => 'string', maxLength => 5}]
  };
validate_ok 'superlong', $schema, E('/', '/allOf/0 String is too long: 9/7.'),
  E('/', '/allOf/1 String is too long: 9/5.');
validate_ok 'toolong', $schema, E('/', '/allOf/1 String is too long: 7/5.');

done_testing;