Branch Coverage

blib/lib/Web/Microformats2/Parser.pm
Criterion Covered Total %
branch 170 184 92.3


line true false branch
32 0 74 if ($args{'url_context'})
49 6 68 if (my $base_url = $tree->findvalue('.//base/@href'))
65 1015 898 unless &blessed($element) and $element->isa('HTML::Element')
73 136 762 if ($h_attrs->[0])
79 94 42 unless ($current_item)
85 1668 1924 unless $current_item
86 1621 303 unless @{$properties_ref;}
87 190 113 if ($mf2_type eq 'p') { }
44 69 elsif ($mf2_type eq 'u') { }
18 51 elsif ($mf2_type eq 'e') { }
51 0 elsif ($mf2_type eq 'dt') { }
94 158 32 unless ($new_item)
97 161 2 if (defined $value)
114 42 2 unless ($new_item)
118 38 5 if (my $url = $self->_tease_out_url($element)) { }
2 3 elsif (@$vcp_fragments_ref) { }
2 1 elsif ($url = $self->_tease_out_unlikely_url($element)) { }
149 14 28 if (ref $content_piece) { }
155 9 35 if ($url)
186 22 29 if (@$vcp_fragments_ref) { }
26 3 elsif (my $alt = $element->findvalue('./@datetime|@title|@value')) { }
3 0 elsif (my $text = $element->as_trimmed_text) { }
195 51 0 if (defined $dt_string)
205 136 762 if ($new_item) { }
214 324 84 unless ($new_item->has_property($impliable_property))
226 33 103 if ($current_item and @item_properties) { }
9 94 elsif ($current_item) { }
241 35 2 if ($item_property =~ /^p-/) { }
2 0 elsif ($item_property =~ /^u-/) { }
242 28 7 if (my $name = $new_item->get_properties('name')->[0]) { }
254 37 0 if defined $value_attribute
279 538 515 if ($class_attr)
297 26 17 if ($element->tag =~ /^(a|area|link)$/) { }
10 7 elsif ($element->tag =~ /^(img|audio)$/) { }
1 6 elsif ($element->tag eq 'video') { }
1 5 elsif ($element->tag eq 'object') { }
310 38 5 if ($xpath)
314 38 5 if (defined $url)
327 1 2 if ($element->tag eq 'abbr') { }
1 1 elsif ($element->tag =~ /^(data|input)$/) { }
334 2 1 if ($xpath)
347 24 59 if $item->has_properties or $item->has_children
353 8 51 if ($element->tag =~ /^(img|area)$/) { }
1 50 elsif ($element->tag eq 'abbr') { }
7 43 elsif ($kid = $self->_non_h_unique_child($element, 'img') or $kid = $self->_non_h_unique_child($element, 'area')) { }
1 42 elsif ($kid = $self->_non_h_unique_child($element, 'abbr')) { }
3 39 elsif ($kid = $self->_non_h_unique_grandchild($element, 'img') or $kid = $self->_non_h_unique_grandchild($element, 'area')) { }
1 38 elsif ($kid = $self->_non_h_unique_grandchild($element, 'abbr')) { }
384 21 38 if ($xpath)
387 19 2 if ($value ne '' or $accept_if_empty)
392 40 19 unless (defined $name)
396 59 0 if (length $name > 0)
410 5 121 if ($element->tag eq 'img') { }
1 120 elsif ($element->tag eq 'object') { }
4 116 elsif ($kid = $self->_non_h_unique_child($element, 'img')) { }
2 114 elsif ($kid = $self->_non_h_unique_child($element, 'object')) { }
3 111 elsif ($kid = $self->_non_h_unique_grandchild($element, 'img')) { }
1 110 elsif ($kid = $self->_non_h_unique_grandchild($element, 'object')) { }
433 16 110 if ($xpath)
437 16 110 if (defined $url)
452 23 92 if ($element->tag =~ /^(a|area)$/) { }
10 82 elsif ($kid = $self->_non_h_unique_child($element, 'a') or $kid = $self->_non_h_unique_child($element, 'area') or $kid = $self->_non_h_unique_grandchild($element, 'a') or $kid = $self->_non_h_unique_grandchild($element, 'area')) { }
465 33 82 if ($xpath)
469 33 82 if (defined $url)
480 802 1062 if ref $_
482 38 604 if (@children == 1)
484 32 6 unless ($mf2_attrs->{'h'}[0])
498 117 395 if (@children == 1)
500 89 28 unless ($mf2_attrs->{'h'}[0])
522 57 291 if ($class and $class =~ /\bvalue(-title)?\b/) { }
523 6 51 if ($1) { }
20 31 elsif ($element->tag =~ /^(del|ins|time)$/ and defined $element->attr('datetime')) { }
532 0 31 if (ref $content_piece) { }
583 14 8 unless defined $seconds
602 1 21 if ($dt_string =~ /^\d\d:/)
603 1 0 if (my $previous_dt = $current_item->last_seen_date) { }
619 0 22 if $@
621 22 0 if ($date_is_defined)
625 7 15 if ($am_or_pm =~ /^[pP]/)
631 21 1 if ($dt_string =~ /-/ and $dt_string =~ /[ T]/) { }
1 0 elsif ($dt_string =~ /-/) { }
633 2 19 if ($provided_offset eq 'Z') { }
7 12 elsif ($provided_offset) { }
642 8 13 if length $seconds
659 11 159 if (@$vcp_fragments_ref) { }
9 150 elsif (my $alt = $element->findvalue('./@title|@value|@alt')) { }
148 2 elsif (my $text = _trim(decode_entities($element->as_text))) { }
675 799 99 unless $element->tag =~ /^(a|link)$/
678 57 42 unless defined $rel
690 0 168 if defined $rel_url_value->{$_}
692 6 162 if (defined $value)
697 42 0 if (defined $text)