Branch Coverage

lib/Text/JSContact.pm
Criterion Covered Total %
branch 310 514 60.3


line true false branch
29 355 98 unless $items and @$items
36 331 87 unless $prop
43 232 65 unless defined $val
44 65 0 ref $val eq 'ARRAY' ? :
50 62 81 unless defined $val
52 81 0 ref $val eq 'ARRAY' ? :
58 36 74 if defined $pid and $pid ne ""
64 0 145 unless defined $val
65 0 145 if ($val =~ /[\x80-\xff]/)
76 21 29 if ($lt eq 'home') { }
8 21 elsif ($lt eq 'work') { }
79 29 48 %ctx ? :
86 14 59 if (defined $pref and &looks_like_number($pref))
91 4 36 if lc $t eq "pref"
98 0 5 unless defined $val
100 5 0 if ($val =~ /^(\d{4})-?(\d{2})-?(\d{2})T(\d{2}):?(\d{2}):?(\d{2})/)
111 8 112 if $i == 8 or $i == 12 or $i == 16 or $i == 20
120 157 18 unless defined $val and $val ne ""
121 9 9 if $transform
122 18 0 if defined $val
130 0 270 unless my $group = $lp->{'group'}
132 105 165 if $val =~ /^_\$\!<([^>]*)>\!\$_$/
140 11 52 if (my $group = $prop->{'group'})
141 10 1 if (my $label = $labels->{$group})
149 0 13 unless defined $val
152 13 0 if ($val =~ /^(\d{4}|--)-?(\d{2})-?(\d{2})(?:T|$)/)
154 0 13 if $y eq "--"
155 0 13 if $y eq 1604
160 0 0 if $val =~ /^\d{4}-\d{2}-\d{2}/
168 0 42 unless defined $val
169 0 42 if (ref $val eq "ARRAY")
170 0 0 if defined $_
172 35 7 if $val ne ""
184 0 35 unless $parsed and $parsed->{'objects'} and @{$parsed->{'objects'};}
187 0 35 unless $vcard and $vcard->{'type'} eq "vcard"
247 35 0 if defined $fn
250 11 24 if ($n_prop)
258 35 42 unless defined $raw
261 0 42 ref $raw eq 'ARRAY' ? :
265 0 38 unless defined $v and $v ne ""
274 11 0 if @components
278 1 10 if ($sort_as_param)
282 2 0 if $i <= $#kind_map and defined $sa[$i] and $sa[$i] ne ""
285 1 0 if %sort_map
293 0 34 if ($phonFirst or $phonLast or $phonMid)
295 1 0 if $phonFirst
296 0 1 if $phonMid
297 1 0 if $phonLast
301 35 0 if %$name
312 0 5 unless defined $val and $val ne ""
315 0 5 if (my $ctx = _make_contexts(_params_list($item, "type")))
318 0 5 if (my $pref = _make_pref($item))
322 5 0 if %map
334 0 19 unless defined $val and $val ne ""
337 11 8 if (my $ctx = _make_contexts(_params_list($item, "type")))
340 5 14 if (my $pref = _make_pref($item))
345 8 0 if %map
363 0 13 unless defined $val and $val ne ""
368 6 7 if (my $ctx = _make_contexts(@types))
375 10 7 if $feat
377 10 3 if %features
379 3 10 if (my $pref = _make_pref($item))
384 8 0 if %map
397 0 0 if $geo->{'group'}
400 0 0 if $tz->{'group'}
430 7 0 if @components
434 0 7 if defined $label_param
437 1 6 if $item->{'group'}
438 0 7 if defined $geo
441 1 6 if $item->{'group'}
442 0 7 if defined $tz
446 1 5 if (not $cc and $item->{'group'})
448 1 0 if (($xabadr->{'group'} // "") eq $item->{'group'})
454 2 5 if defined $cc
457 7 0 if (my $ctx = _make_contexts(@types))
460 2 5 if (my $pref = _make_pref($item))
466 7 0 if %map
481 0 8 ref $values->[0] eq 'ARRAY' ? :
482 8 0 if defined $_
483 8 0 if $org_name ne ""
488 0 6 ref $values->[$i] eq 'ARRAY' ? :
490 0 6 unless defined $v and $v ne ""
494 5 3 if @units
498 1 7 if (defined $sort_as)
500 1 0 if defined $sa[0] and $sa[0] ne ""
502 0 2 if defined $sa[$i + 1] and $sa[$i + 1] ne ""
507 0 8 if (my $ctx = _make_contexts(@types))
514 8 0 if %map
526 0 6 unless defined $val and $val ne ""
532 4 31 if %map
545 0 11 unless defined $val and $val ne ""
558 0 2 unless defined $val and $val ne ""
562 2 0 if (my $group = $item->{'group'})
564 2 0 if ($label)
566 1 1 if ($lt eq 'anniversary') { }
0 1 elsif ($lt eq 'other') { }
579 8 27 if %map
590 0 8 unless defined $val and $val ne ""
595 1 7 if defined $created
599 1 7 if ($author_name or $author_uri)
601 1 0 if $author_name
602 0 1 if $author_uri
609 8 0 if %map
621 0 7 unless defined $val and $val ne ""
625 1 6 if defined $service
627 0 7 if defined $user
629 0 7 if (my $ctx = _make_contexts(@types))
630 3 4 if (my $pref = _make_pref($item))
638 0 3 unless defined $val and $val ne ""
642 3 0 if ($val =~ m[://]) { }
646 2 1 unless ($service)
649 2 0 if ($lt ne "home" and $lt ne "work" and $lt ne "pref")
655 3 0 if defined $service
658 2 1 if defined $user and not $obj->{'user'}
661 0 3 if (my $ctx = _make_contexts(@types))
662 0 3 if (my $pref = _make_pref($item))
683 0 2 unless defined $val and $val ne ""
687 0 2 if (my $ctx = _make_contexts(@types))
688 0 2 if (my $pref = _make_pref($item))
694 4 31 if %map
707 0 4 unless defined $val and $val ne ""
712 0 4 if ($encoding and lc $encoding eq 'b') { }
714 0 0 if $mediatype and not $mediatype =~ m[/]
721 2 2 if defined $mt
724 0 4 if (my $pref = _make_pref($item))
730 4 31 if %map
741 0 8 unless defined $val and $val ne ""
744 2 6 if defined $kind
746 0 8 if defined $mt
748 2 6 if (my $ctx = _make_contexts(@types))
749 1 7 if (my $pref = _make_pref($item))
754 8 272 if (%map)
800 0 3 unless defined $val and $val ne ""
804 3 0 if (my $ctx = _make_contexts(@types))
805 2 1 if (my $pref = _make_pref($item))
809 1 0 if %map
823 0 2 unless defined $val and $val ne ""
828 2 0 if ($level)
833 2 0 if defined $index
839 1 34 if %map
850 0 3 unless defined $val
854 8 0 if $cat ne ""
858 3 0 if %keywords
869 0 10 unless defined $val and $val ne ""
874 4 31 if %members
887 0 5 unless defined $val and $val ne ""
893 5 0 if $lt =~ /^(acquaintance|agent|child|co-resident|co-worker|colleague|contact|crush|date|emergency|friend|kin|me|met|muse|neighbor|parent|sibling|spouse|sweetheart)$/
896 5 0 if %relation
911 0 6 unless defined $val and $val ne ""
918 6 0 if (my $group = $item->{'group'})
921 6 0 if ($label)
923 6 0 if (my $mapped = $ablabel_relation{$lt})
927 6 0 if %relation
931 6 29 if %related
940 1 34 if (my $gg = _first_value($props, "gramgender"))
944 1 34 if (my $items = $props->{'pronouns'})
948 0 2 unless defined $val and $val ne ""
951 0 2 if (my $ctx = _make_contexts(_params_list($item, "type")))
954 2 0 if (my $pref = _make_pref($item))
957 1 0 if %pronouns
960 1 34 if %$speak
977 2 0 if $card->{'uid'}
981 0 2 if $card->{'kind'} and $card->{'kind'} ne "individual"
984 2 0 if $card->{'prodId'}
987 1 1 if $card->{'updated'}
990 0 2 if $card->{'created'}
993 0 2 if $card->{'language'}
1042 0 10 unless $contexts and ref $contexts eq "HASH"
1044 7 3 if $contexts->{'private'}
1045 3 7 if $contexts->{'work'}
1051 5 21 if defined $pref
1061 9 4 unless defined $label and $label ne ""
1077 10 17 if ($obj->{'contexts'})
1079 10 0 if @types
1088 3 0 if (my $full = $name->{'full'})
1093 3 0 if (my $components = $name->{'components'})
1103 12 9 $vals ? :
1110 0 3 if ($name->{'sortAs'} and ref $name->{'sortAs'} eq "HASH")
1116 0 0 if @sa
1123 0 0 if (not $name->{'full'} and $name->{'components'})
1126 0 0 if ($c->{'kind'} // "") eq "separator"
1129 0 0 if @parts
1177 4 1 if ($ph->{'features'})
1180 4 0 if $type
1205 0 2 if $adr->{'full'}
1206 0 2 if $adr->{'coordinates'}
1207 0 2 if $adr->{'timeZone'}
1208 1 1 if $adr->{'countryCode'}
1213 2 0 if (my $components = $adr->{'components'})
1216 0 10 if ($c->{'kind'} // "") eq "separator"
1218 10 0 if defined $idx
1239 2 0 if ($org->{'units'})
1245 0 2 if (defined $org->{'sortAs'})
1247 0 0 if ($org->{'units'})
1253 0 0 if @sa
1266 1 2 ($t->{'kind'} // 'title') eq 'role' ? :
1286 0 4 if $date =~ /^0000-(\d{2})-(\d{2})/
1300 0 2 if ($note->{'created'})
1303 0 2 if ($note->{'author'})
1304 0 0 if $note->{'author'}{'name'}
1305 0 0 if $note->{'author'}{'uri'}
1322 5 0 if $svc->{'service'}
1323 4 1 if $svc->{'user'}
1341 1 0 if $m->{'mediaType'}
1353 0 2 $kind eq 'contact' ? :
0 2 $kind eq 'freeBusy' ? :
1359 0 2 if $link->{'mediaType'}
1373 0 1 if $r->{'mediaType'}
1397 0 0 $kind eq 'entry' ? :
1401 0 0 if $dir->{'mediaType'}
1429 0 0 if ($pi->{'level'})
1432 0 0 if (defined $pi->{'listAs'})
1442 0 1 unless ref $keywords eq "HASH" and %$keywords
1460 0 3 unless $val =~ /^urn:uuid:/
1472 3 0 if ($rel->{'relation'} and ref $rel->{'relation'} eq "HASH")
1474 3 0 if @types
1484 0 0 if ($sta->{'grammaticalGender'})
1488 0 0 if ($sta->{'pronouns'})
1510 1 5 unless %changed
1514 0 5 unless $parsed
1517 0 5 unless $vcard and $vcard->{'type'} eq "vcard"
1525 66 0 if $props->{$name} and @{$props->{$name};}
1564 0 5 unless $vcard_names
1571 1 7 if $item->{'group'}
1577 1 0 if (%groups_to_remove and $props->{'x-ablabel'})
1582 0 1 unless @{$props->{'x-ablabel'};}
1591 1 4 if ($changed{'name'})
1592 0 5 if ($changed{'nicknames'})
1593 1 4 if ($changed{'emails'})
1594 1 4 if ($changed{'phones'})
1595 0 5 if ($changed{'addresses'})
1596 0 5 if ($changed{'organizations'})
1597 0 5 if ($changed{'titles'})
1598 0 5 if ($changed{'anniversaries'})
1599 1 4 if ($changed{'notes'})
1600 0 5 if ($changed{'onlineServices'})
1601 0 5 if ($changed{'media'})
1602 0 5 if ($changed{'links'})
1603 0 5 if ($changed{'calendars'})
1604 0 5 if ($changed{'schedulingAddresses'})
1605 0 5 if ($changed{'cryptoKeys'})
1606 0 5 if ($changed{'directories'})
1607 0 5 if ($changed{'keywords'})
1608 1 4 if ($changed{'members'})
1609 1 0 if ($original_has{'x-addressbookserver-member'}) { }
1615 0 5 if ($changed{'relatedTo'})
1616 0 5 if ($changed{'speakToAs'})
1617 0 5 if ($changed{'preferredLanguages'})
1618 0 5 if ($changed{'personalInfo'})
1624 0 25 if ($changed{$js})
1625 0 0 if (defined $new_card->{$js} and $new_card->{$js} ne "")
1630 0 5 if ($changed{'kind'})
1631 0 0 if (defined $new_card->{'kind'} and $new_card->{'kind'} ne "")
1632 0 0 $original_has{'x-addressbookserver-kind'} ? :
1665 0 0 unless defined $old_val or defined $new_val
1668 1 53 unless (defined $old_val and defined $new_val)
1676 4 49 if $old_json ne $new_json