Debian Codegraph @

t/zzz-acceptance-draft4.t

raw
1 # vim: set ft=perl ts=8 sts=2 sw=2 tw=100 et :
2 use strictures 2;
3 use 5.020;
4 use stable 0.031 'postderef';
5 use experimental 'signatures';
6 no autovivification warn => qw(fetch store exists delete);
7 use if "$]" >= 5.022, experimental => 're_strict';
8 no if "$]" >= 5.031009, feature => 'indirect';
9 no if "$]" >= 5.033001, feature => 'multidimensional';
10 no if "$]" >= 5.033006, feature => 'bareword_filehandles';
11 no if "$]" >= 5.041009, feature => 'smartmatch';
12 no feature 'switch';
13 use open ':std', ':encoding(UTF-8)'; # force stdin, stdout, stderr into utf8
14
15 use List::Util 1.50 'head';
16 use Config;
17 use lib 't/lib';
18 use Helper;
19 use Acceptance;
20 use Test::Needs;
21
22 BEGIN {
23 my @variables = qw(AUTHOR_TESTING AUTOMATED_TESTING EXTENDED_TESTING);
24
25 plan skip_all => 'These tests may fail if the test suite continues to evolve! They should only be run with '
26 .join(', ', map $_.'=1', head(-1, @variables)).' or '.$variables[-1].'=1'
27 if not grep $ENV{$_}, @variables;
28
29 test_needs({ 'Test::JSON::Schema::Acceptance' => '1.036' }); # bad remotes
30 }
31
32 my $version = 'draft4';
33
34 my $orig_warn_handler = $SIG{__WARN__};
35 $SIG{__WARN__} = sub {
36 return if $_[0] =~ /^no-longer-supported "id" keyword present \(at location "[^"]+"\): this should be rewritten as "\$id"/;
37 goto &$orig_warn_handler if $orig_warn_handler;
38 };
39
40 acceptance_tests(
41 acceptance => {
42 specification => $version,
43 skip_dir => 'optional/format',
44 },
45 evaluator => {
46 specification_version => $version,
47 validate_formats => 0, # not the default for the Format vocabulary for this draft
48 collect_annotations => 0,
49 },
50 output_file => $version.'-acceptance.txt',
51 test => {
52 $ENV{NO_TODO} ? () : (todo_tests => [
53 # various edge cases that are difficult to accomodate
54 $Config{ivsize} < 8 ? { file => 'multipleOf.json', group_description => 'small multiple of large integer', test_description => 'any integer is a multiple of 1e-8' } : (),
55 { file => 'optional/ecmascript-regex.json', group_description => '\w in patterns matches [A-Za-z0-9_], not unicode letters', test_description => [ 'literal unicode character in json string', 'unicode character in hex format in string' ] },
56 { file => 'optional/ecmascript-regex.json', group_description => '\d in pattern matches [0-9], not unicode digits', test_description => 'non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)' },
57 { file => 'optional/ecmascript-regex.json', group_description => '\w in patternProperties matches [A-Za-z0-9_], not unicode letters', test_description => [ 'literal unicode character in json string', 'unicode character in hex format in string' ] },
58 { file => 'optional/ecmascript-regex.json', group_description => '\d in patternProperties matches [0-9], not unicode digits', test_description => 'non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)' },
59 { file => 'optional/ecmascript-regex.json', group_description => [ 'ECMA 262 \d matches ascii digits only', 'ECMA 262 \D matches everything but ascii digits', 'ECMA 262 \w matches ascii letters only', 'ECMA 262 \W matches everything but ascii letters' ] }, # TODO, see test suite PR#505
60 { file => 'optional/ecmascript-regex.json', group_description => 'ECMA 262 \s matches whitespace', test_description => 'zero-width whitespace matches' },
61 { file => 'optional/ecmascript-regex.json', group_description => 'ECMA 262 \S matches everything but whitespace', test_description => 'zero-width whitespace does not match' },
62 ]),
63 },
64 );
65
66 END {
67 diag <<DIAG
68
69 ###############################
70
71 Attention CPANTesters: you do not need to file a ticket when this test fails. I will receive the test reports and act on it soon. thank you!
72
73 ###############################
74 DIAG
75 if not is_passing;
76 }
77
78 done_testing;
79 __END__
80 see t/results/draft4-acceptance.txt for test results