Debian Codegraph @

t/17-skip_tests.t

raw
1 # vim: set ts=8 sts=2 sw=2 tw=100 et :
2 use strict;
3 use warnings;
4 use 5.020;
5 use strictures 2;
6 use stable 0.031 'postderef';
7 use experimental 'signatures';
8 no autovivification warn => qw(fetch store exists delete);
9 use if "$]" >= 5.022, experimental => 're_strict';
10 no if "$]" >= 5.031009, feature => 'indirect';
11 no if "$]" >= 5.033001, feature => 'multidimensional';
12 no if "$]" >= 5.033006, feature => 'bareword_filehandles';
13 no if "$]" >= 5.041009, feature => 'smartmatch';
14
15 use Test2::API 'intercept';
16 use Test2::V0 qw(!bag !bool), -no_pragmas => 1;
17 use if $ENV{AUTHOR_TESTING}, 'Test2::Warnings';
18 use Test::JSON::Schema::Acceptance;
19 use Test::File::ShareDir -share => { -dist => { 'Test-JSON-Schema-Acceptance' => 'share' } };
20
21 use lib 't/lib';
22 use SchemaParser;
23 use Helper;
24
25 my $accepter = Test::JSON::Schema::Acceptance->new(test_dir => 't/tests/subset');
26 my $parser = SchemaParser->new;
27
28 foreach my $test (
29 # match tests in this file
30 { todo_count => 0, skip_tests => [ { file => 'foo.json' } ],
31 results => [
32 { file => str('bar.json'), pass => 0, todo_fail => 0, fail => 9 },
33 { file => str('baz.json'), pass => 3, todo_fail => 0, fail => 0 },
34 { file => str('foo.json'), pass => 0, todo_fail => 0, fail => 0 },
35 ],
36 },
37 ) {
38 my $events = intercept(
39 sub {
40 $accepter->acceptance(
41 validate_data => sub ($schema, $data) {
42 return $parser->validate_data($data, $schema);
43 },
44 %$test,
45 );
46 }
47 );
48
49 is(scalar(grep $_->isa('Test2::Event::Skip'), @$events), 3, 'skipped some tests');
50
51 cmp_result(
52 $accepter->results,
53 $test->{results},
54 'result data was populated',
55 );
56 }
57
58 done_testing;