Branch Coverage

blib/lib/Test/JSON/Schema/Acceptance.pm
Criterion Covered Total %
branch 110 134 82.0


line true false branch
132 1 51 unless -d $self->test_dir
137 4 52 ref $_[0] eq 'CODE' ? :
140 0 7 unless $$options{"validate_data"} or $$options{"validate_json_string"}
143 0 56 if $$options{"validate_data"} and $$options{"validate_json_string"}
145 5 51 if $$options{"skip_tests"}
149 1 55 if ($$options{"add_resource"} and -d $self->additional_resources)
156 4 5 unless $path->is_file and $path =~ /\.json$/u
162 1 4 if $topdir =~ /^(?:draft(?:[3467]|2019-09|2020-12)|v1)\z/u and not grep(($topdir eq $_), @{$self->supported_specifications})
166 2 2 $topdir =~ /^draft/u ? :
174 27 29 $self->_has_specification ? :
186 3 20 ref $$options{'tests'}{'file'} eq 'ARRAY' ? :
11 21 if $$options{"tests"} and $$options{"tests"}{"file"} and not grep(($_ eq $$one_file{"file"}), ref $$options{"tests"}{"file"} eq "ARRAY" ? @{$$options{"tests"}{"file"}} : $$options{"tests"}{"file"})
194 3 35 ref $$options{'tests'}{'group_description'} eq 'ARRAY' ? :
24 29 if $$options{"tests"} and $$options{"tests"}{"group_description"} and not grep(($_ eq $$test_group{"description"}), ref $$options{"tests"}{"group_description"} eq "ARRAY" ? @{$$options{"tests"}{"group_description"}} : $$options{"tests"}{"group_description"})
205 28 19 if !$$o{'file'} || grep(($_ eq $$one_file{'file'}), ref $$o{'file'} eq 'ARRAY' ? @{$$o{'file'}} : $$o{'file'}) and !$$o{'group_description'} || grep(($_ eq $$test_group{'description'}), ref $$o{'group_description'} eq 'ARRAY' ? @{$$o{'group_description'}} : $$o{'group_description'})
206 16 920 if $$options{"todo_tests"} and &any(sub { my $o = $_; not $$o{"test_description"} if !$$o{'file'} || grep(($_ eq $$one_file{'file'}), ref $$o{'file'} eq 'ARRAY' ? @{$$o{'file'}} : $$o{'file'}) and !$$o{'group_description'} || grep(($_ eq $$test_group{'description'}), ref $$o{'group_description'} eq 'ARRAY' ? @{$$o{'group_description'}} : $$o{'group_description'}); } , @{$$options{"todo_tests"}})
209 0 936 if ($self->test_schemas)
210 0 0 unless $self->_has_specification
215 0 0 Ref::Util::XS::is_plain_hashref($$test_group{'schema'}) && $$test_group{'schema'}{'$schema'} ? :
219 0 0 $$options{'validate_data'} ? :
220 0 0 unless ($result)
231 33 15 ref $$options{'tests'}{'test_description'} eq 'ARRAY' ? :
31 57 if $$options{"tests"} and $$options{"tests"}{"test_description"} and not grep(($_ eq $$test{"description"}), ref $$options{"tests"}{"test_description"} eq "ARRAY" ? @{$$options{"tests"}{"test_description"}} : $$options{"tests"}{"test_description"})
237 47 3128 if ref $$options{"skip_tests"} eq "ARRAY" and grep((($$test_group{"description"} . ' - ' . $$test{"description"}) =~ /$_/u), @{$$options{"skip_tests"}})
247 33 3 ref $$o{'test_description'} eq 'ARRAY' ? :
84 57 if !$$o{'file'} || grep(($_ eq $$one_file{'file'}), ref $$o{'file'} eq 'ARRAY' ? @{$$o{'file'}} : $$o{'file'}) and !$$o{'group_description'} || grep(($_ eq $$test_group{'description'}), ref $$o{'group_description'} eq 'ARRAY' ? @{$$o{'group_description'}} : $$o{'group_description'})
249 61 3114 if $$options{"todo_tests"} and &any(sub { my $o = $_; not $$o{"test_description"} or grep(($_ eq $$test{"description"}), ref $$o{"test_description"} eq "ARRAY" ? @{$$o{"test_description"}} : $$o{"test_description"}) if !$$o{'file'} || grep(($_ eq $$one_file{'file'}), ref $$o{'file'} eq 'ARRAY' ? @{$$o{'file'}} : $$o{'file'}) and !$$o{'group_description'} || grep(($_ eq $$test_group{'description'}), ref $$o{'group_description'} eq 'ARRAY' ? @{$$o{'group_description'}} : $$o{'group_description'}); } , @{$$options{"todo_tests"}})
252 0 3175 if $schema_fails
254 34 1213 $todo ? :
1928 1247 $result ? :
263 0 56 $self->verbose ? :
266 43 13 if (not $self->test_dir =~ /\boptional\b/u and grep((!($our $_{'file'} =~ m[^optional/]u) && $our $_{'todo_fail'} + $our $_{'fail'}), @results)) { }
294 1311 1864 $$options{'validate_data'} ? :
302 1881 1292 $$test{'valid'} ? :
303 1225 1948 if ($result_bool xor $$test{'valid'}) { }
304 1174 51 $result_bool ? :
305 0 1225 $self->verbose ? :
306 0 1225 $self->verbose ? :
307 736 489 ref $$test{'data'} ? :
311 0 1225 $self->verbose ? :
328 9 3164 if ($data_before ne $data_after) { }
1 3163 elsif (@mutated_data_paths) { }
337 0 4 @mutated_data_paths > 1 ? :
4 3169 if @mutated_data_paths
339 9 3164 if ($schema_before ne $schema_after) { }
1 3163 elsif (@mutated_schema_paths) { }
348 0 4 @mutated_schema_paths > 1 ? :
4 3169 if @mutated_schema_paths
371 297 19578 unless (defined $$node[1])
374 2259 17319 if (Ref::Util::XS::is_plain_arrayref($$node[1])) { }
8104 9215 elsif (Ref::Util::XS::is_plain_hashref($$node[1])) { }
1977 7238 elsif (Ref::Util::XS::is_ref($$node[1])) { }
376 0 2259 if tied @{$$node[1]}
380 2 8102 if tied %{$$node[1]}
387 6 7232 unless $flags & 1024 xor $flags & 768
463 2 643 if &any(sub { $self->test_dir->child($_)->subsumes($path); } , @{$self->skip_dir})
464 26 617 unless $path->is_file
465 2 615 unless $path =~ /\.json$/u
467 28 587 unless @$data
482 0 198 unless $our $a[0] <=> $our $b[0]
496 3 29 if ($submodule_status->exists and $submodule_status->parent->subsumes($self->test_dir)) { }
0 58 elsif ($test_dir eq $orig_dir and not -d '.git') { }
507 29 3 if ($test_dir ne $orig_dir)
509 0 29 if ($orig_dir->subsumes($test_dir)) { }
29 0 elsif ('Path::Tiny'->cwd->subsumes($test_dir)) { }
518 0 29 unless $local
524 2 30 $self->include_optional ? :