Test/HashRef.pm

filter: Statementstmt 100% 40 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 14 / 14 Podpod 0.0% 0 / 6 totaltotal 90.0% 54 / 60 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary blib/lib/Merge/HashRef.pm »
1 package Test::HashRef;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base 'Test::Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Merge::HashRef;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶sub make_hashrefs : Test(setup) {
Subroutine make_hashrefs: called CC=1 SCAR=0.0
Pod undocumented
11 2 my $self = shift;
12 2 $self->{h1} = { one => 1, two => 2, three => 3 };
13 2 $self->{h2} = { four => 4, five => 5 };
14 2 $self->{h3} = { one => 'one', four => 'four' };
15 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 ▶sub hash1 { shift->{h1} }
Subroutine hash1: called CC=1 SCAR=0.0
Pod undocumented
18 2 ▶sub hash2 { shift->{h2} }
Subroutine hash2: called CC=1 SCAR=0.0
Pod undocumented
19 2 ▶sub hash3 { shift->{h3} }
Subroutine hash3: called CC=1 SCAR=0.0
Pod undocumented
20  
21 1 ▶sub merge_one_way : Test(2) {
Subroutine merge_one_way: called CC=1 SCAR=0.0
Pod undocumented
22 1 my $self = shift;
23 1 my $hash = Merge::HashRef::merge_hashref($self->hash3, $self->hash2, $self->hash1);
24 1 is $hash->{four}, 4, "numeric value overwrites aplhabetic one";
25 1 is $hash->{five}, 5, "numeric value overwrites aplhabetic one (second time)";
26 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 1 ▶sub merge_other_way : Test(2) {
Subroutine merge_other_way: called CC=1 SCAR=0.0
Pod undocumented
29 1 my $self = shift;
30 1 my $hash = Merge::HashRef::merge_hashref($self->hash1, $self->hash2, $self->hash3);
31 1 is $hash->{four}, 'four', "aplhabetic value overwrites numeric one";
32 1 is $hash->{five}, 5, "aplhabetic value overwrites numeric one (second time)";
33  
34 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 1 1;
↑ Summary blib/lib/Merge/HashRef.pm »