| 1 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | package Test::Deep::YAML; # git description: v0.003-2-g42e13ef | ||||||||||||||||||||||||||||
| 4 | # ABSTRACT: A Test::Deep plugin for comparing YAML-encoded data | ||||||||||||||||||||||||||||
| 5 | # KEYWORDS: testing tests plugin YAML data | ||||||||||||||||||||||||||||
| 6 | # vim: set ts=8 sts=4 sw=4 tw=78 et : | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.004'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | our @EXPORT = qw(yaml); | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub yaml | ||||||||||||||||||||||||||||
| 15 | 9 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
yaml: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 9 | my ($expected) = @_; | |||||||||||||||||||||||||||
| 17 | 9 | return Test::Deep::YAML::Object->new($expected); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | package # hide from PAUSE | ||||||||||||||||||||||||||||
| 21 | Test::Deep::YAML::Object; | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | our $VERSION = '0.004'; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use parent 'Test::Deep::Cmp'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use Try::Tiny (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use YAML (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | sub init | ||||||||||||||||||||||||||||
| 30 | 9 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | 9 | my ($self, $expected) = @_; | |||||||||||||||||||||||||||
| 32 | 9 | $self->{val} = $expected; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | sub descend | ||||||||||||||||||||||||||||
| 36 | 9 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
descend: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 37 | 9 | my ($self, $got) = @_; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | my $data = Try::Tiny::try | ||||||||||||||||||||||||||||
| 40 | 9 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 41 | 9 | YAML::Load($got); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | Try::Tiny::catch | ||||||||||||||||||||||||||||
| 44 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | 1 | chomp($self->{error_message} = $_); | |||||||||||||||||||||||||||
| 46 | 1 | undef; | |||||||||||||||||||||||||||
| 47 | 9 | }; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 9 | ▶ | return 0 if not $data or $self->{error_message}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $data or $self->{"error_message"}
MC/DC50%1/2
not $data or $self->{"error_message"}
not $data
$self->{"error_message"}
Truth table66%2/3
not(A) or B
A= not $dataB= $self->{"error_message"}
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 8 | return Test::Deep::wrap($self->{val})->descend($data); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | sub diagnostics | ||||||||||||||||||||||||||||
| 55 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
diagnostics: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||
| 56 | 2 | my ($self, $where, $last) = @_; | |||||||||||||||||||||||||||
| 57 | return $self->{error_message} | ||||||||||||||||||||||||||||
| 58 | 2 | ▶ | || $self->{val}->diagnostics($where, $last); | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->{'error_message'} || $self->{'val'}->diagnostics($where, $last)
MC/DC0%0/2
$self->{'error_message'} || $self->{'val'}->diagnostics($where, $last)
$self->{'error_message'}
$self->{'val'}->diagnostics($where, $last)
Truth table66%2/3
A || B
A= $self->{'error_message'}B= $self->{'val'}->diagnostics($where, $last)
| |||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 1 | 1; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||||||