Branch Coverage

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


line true false branch
33 0 74 if ($args{'url_context'})
50 6 68 if (my $base_url = $tree->findvalue('.//base/@href'))
66 1015 898 unless &blessed($element) and $element->isa('HTML::Element')
74 136 762 if ($h_attrs->[0])
80 94 42 unless ($current_item)
86 1668 1924 unless $current_item
87 1621 303 unless @{$properties_ref;}
88 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') { }
95 158 32 unless ($new_item)
98 161 2 if (defined $value)
115 42 2 unless ($new_item)
119 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)) { }
150 14 28 if (ref $content_piece) { }
156 9 35 if ($url)
187 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) { }
196 51 0 if (defined $dt_string)
206 136 762 if ($new_item) { }
215 324 84 unless ($new_item->has_property($impliable_property))
227 33 103 if ($current_item and @item_properties) { }
9 94 elsif ($current_item) { }
242 35 2 if ($item_property =~ /^p-/) { }
2 0 elsif ($item_property =~ /^u-/) { }
243 28 7 if (my $name = $new_item->get_properties('name')->[0]) { }
255 37 0 if defined $value_attribute
280 538 515 if ($class_attr)
298 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') { }
311 38 5 if ($xpath)
315 38 5 if (defined $url)
328 1 2 if ($element->tag eq 'abbr') { }
1 1 elsif ($element->tag =~ /^(data|input)$/) { }
335 2 1 if ($xpath)
348 24 59 if $item->has_properties or $item->has_children
354 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')) { }
385 21 38 if ($xpath)
388 19 2 if ($value ne '' or $accept_if_empty)
393 40 19 unless (defined $name)
397 59 0 if (length $name > 0)
411 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')) { }
434 16 110 if ($xpath)
438 16 110 if (defined $url)
453 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')) { }
466 33 82 if ($xpath)
470 33 82 if (defined $url)
481 802 1062 if ref $_
483 38 604 if (@children == 1)
485 32 6 unless ($mf2_attrs->{'h'}[0])
499 117 395 if (@children == 1)
501 89 28 unless ($mf2_attrs->{'h'}[0])
523 57 291 if ($class and $class =~ /\bvalue(-title)?\b/) { }
524 6 51 if ($1) { }
20 31 elsif ($element->tag =~ /^(del|ins|time)$/ and defined $element->attr('datetime')) { }
533 0 31 if (ref $content_piece) { }
584 14 8 unless defined $seconds
603 1 21 if ($dt_string =~ /^\d\d:/)
604 1 0 if (my $previous_dt = $current_item->last_seen_date) { }
620 0 22 if $@
622 22 0 if ($date_is_defined)
626 7 15 if ($am_or_pm =~ /^[pP]/)
632 21 1 if ($dt_string =~ /-/ and $dt_string =~ /[ T]/) { }
1 0 elsif ($dt_string =~ /-/) { }
634 2 19 if ($provided_offset eq 'Z') { }
7 12 elsif ($provided_offset) { }
643 8 13 if length $seconds
660 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))) { }
676 799 99 unless $element->tag =~ /^(a|link)$/
679 57 42 unless defined $rel
691 0 168 if defined $rel_url_value->{$_}
693 6 162 if (defined $value)
698 42 0 if (defined $text)