Test/JSON/Assert.pm

filter: Statementstmt 47.3% 18 / 38 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod 100% 4 / 4 totaltotal 52.9% 27 / 51 SCAR 1.4
CC
1
Cov
47%
is_jpath_count
2.0
does_jpath_value_match
2.0
do_jpath_values_match
2.0
CRAP 1.1
« JSON/Assert.pm ↑ Summary
1 ## ----------------------------------------------------------------------------
2 # Copyright (C) 2014-2016 NZRS Ltd.
3 ## ----------------------------------------------------------------------------
4 package Test::JSON::Assert;
5  
6 2 ▶use 5.006000;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Test::Builder::Module;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 our @ISA = qw(Test::Builder::Module);
11 2 ▶use JSON::Assert;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 our @EXPORT = qw(
14 is_jpath_count
15 does_jpath_value_match
16 do_jpath_values_match
17 does_jpath_contains
18 );
19  
20  
21 2 my $CLASS = __PACKAGE__;
22  
23 sub is_jpath_count($$$;$) {
24 0 ▶ my ($doc, $jpath, $count, $name) = @_;
Subroutine is_jpath_count: not called CC=1 SCAR=6.9
Pod documented
25  
26 # create the $json_assert object
27 0 my $json_assert = JSON::Assert->new();
28  
29 # do the test and remember the result
30 0 my $is_ok = $json_assert->is_jpath_count($doc, $jpath, $count);
31  
32 0 my $tb = $CLASS->builder();
33 0 return $tb->ok($is_ok, $name);
34 }
35  
36 sub does_jpath_value_match($$$;$) {
37 0 ▶ my ($doc, $jpath, $match, $name) = @_;
Subroutine does_jpath_value_match: not called CC=1 SCAR=6.9
Pod documented
38  
39 0 my $json_assert = JSON::Assert->new();
40  
41 # do the test and remember the result
42 0 my $is_ok = $json_assert->does_jpath_value_match($doc, $jpath, $match);
43  
44 0 my $tb = $CLASS->builder();
45 0 return $tb->ok($is_ok, $name);
46 }
47  
48 sub do_jpath_values_match($$$;$) {
49 0 ▶ my ($doc, $jpath, $match, $name) = @_;
Subroutine do_jpath_values_match: not called CC=1 SCAR=6.9
Pod documented
50  
51 0 my $json_assert = JSON::Assert->new();
52  
53 # do the test and remember the result
54 0 my $is_ok = $json_assert->do_jpath_values_match($doc, $jpath, $match);
55  
56 0 my $tb = $CLASS->builder();
57 0 return $tb->ok($is_ok, $name);
58 }
59  
60 sub does_jpath_contains($$$;$) {
61 0 ▶ my ($doc, $jpath_str, $match, $name) = @_;
Subroutine does_jpath_contains: not called CC=1 SCAR=6.9
Pod documented
62  
63 0 my $json_assert = JSON::Assert->new();
64  
65 # do the test and remember the result
66 0 my $is_ok = $json_assert->does_jpath_contains($doc, $jpath_str, $match);
67  
68 0 my $tb = $CLASS->builder();
69 0 return $tb->ok($is_ok, $name);
70  
71 }
72  
73  
74 2 1;
75  
76 __END__
« JSON/Assert.pm ↑ Summary