File Coverage

blib/lib/Test2/Tools/JSON.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 32 32 100.0


line stmt bran cond sub pod time code
1             package Test2::Tools::JSON;
2 3     3   748580 use strict;
  3         4  
  3         151  
3 3     3   21 use warnings;
  3         19  
  3         214  
4              
5             our $VERSION = "0.06";
6              
7 3     3   39 use Carp ();
  3         6  
  3         65  
8 3     3   1370 use JSON::MaybeXS qw/JSON/;
  3         31805  
  3         225  
9              
10 3     3   1388 use Test2::Compare::JSON();
  3         10  
  3         189  
11              
12             %Carp::Internal = (
13             %Carp::Internal,
14             'Test2::Tools::JSON' => 1,
15             'Test2::Compare::JSON' => 1,
16             );
17              
18             our @EXPORT = qw/json relaxed_json/;
19 3     3   21 use Exporter 'import';
  3         6  
  3         622  
20              
21             sub json ($) {
22 8     8 1 434069 my @caller = caller;
23 8         50 return Test2::Compare::JSON->new(
24             file => $caller[1],
25             lines => [$caller[2]],
26             inref => $_[0],
27             json => JSON->new->utf8,
28             );
29             }
30              
31             sub relaxed_json ($) {
32 1     1 1 16980 my @caller = caller;
33 1         10 return Test2::Compare::JSON->new(
34             file => $caller[1],
35             lines => [$caller[2]],
36             inref => $_[0],
37             json => JSON->new->utf8->relaxed(1),
38             );
39             }
40              
41             1;
42             __END__