| 1 | package Test::Deep::JSON; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use 5.008_001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Test::Deep (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Test::Deep::Cmp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use JSON::MaybeXS; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Exporter::Lite; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | our $VERSION = '0.05'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | our @EXPORT = qw(json); | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 6 | ▶ | sub json ($) { | ||||||||||||||||||||||||||
|
Subroutine
json: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 6 | my ($expected) = @_; | |||||||||||||||||||||||||||
| 16 | 6 | return __PACKAGE__->new($expected); | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 6 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | 6 | my ($self, $expected) = @_; | |||||||||||||||||||||||||||
| 21 | 6 | $self->{val} = $expected; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 6 | ▶ | sub descend { | ||||||||||||||||||||||||||
|
Subroutine
descend: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 6 | my ($self, $got) = @_; | |||||||||||||||||||||||||||
| 26 | 6 | my $parsed = eval { decode_json($got) }; | |||||||||||||||||||||||||||
| 27 | 6 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 1 | $self->{error} = $@; | |||||||||||||||||||||||||||
| 29 | 1 | return 0; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | 5 | return Test::Deep::wrap($self->{val})->descend($parsed); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 2 | ▶ | sub diagnostics { | ||||||||||||||||||||||||||
|
Subroutine
diagnostics: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 36 | 2 | ▶ | return $self->{error} if defined $self->{error} && length $self->{error}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $self->{"error"} and length $self->{"error"}
MC/DC50%1/2
defined $self->{"error"} and length $self->{"error"}
defined $self->{"error"}
length $self->{"error"}
Truth table66%2/3
A and B
A= defined $self->{"error"}B= length $self->{"error"}
| |||||||||||||||||||||||||||||
| 37 | 1 | return $self->{val}->diagnostics(@_); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | 1; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||||||||