Branch Coverage

blib/lib/HTML/Blitz/RuleSet.pm
Criterion Covered Total %
branch 252 372 67.7


line true false branch
40 0 251 if @_ < 1
0 251 if @_ > 1
49 0 1 if @_ < 2
0 1 if @_ > 2
53 0 4 if @_ < 2
0 4 if @_ > 2
57 0 5 if @_ < 2
0 5 if @_ > 2
61 0 13 if @_ < 2
0 13 if @_ > 2
62 11 2 if ($p1->{'type'} eq ":AT-P-IMMEDIATE")
63 2 9 if ($p2->{'type'} eq ":AT-P-IMMEDIATE")
64 2 0 length $p1->{'value'} <= length $p2->{'value'} ? :
68 1 1 if ($p2->{'type'} eq ":AT-P-IMMEDIATE")
71 0 1 unless $p1->{'type'} eq ":AT-P-VARIABLE" and $p2->{'type'} eq ":AT-P-VARIABLE"
76 0 4 if @_ < 2
0 4 if @_ > 2
77 0 4 unless $t1->{'type'} eq ":AT-P-TRANSFORM" and $t2->{'type'} eq ":AT-P-TRANSFORM"
83 0 8 if @_ < 1
0 8 if @_ > 1
89 0 18 if @_ < 2
0 18 if @_ > 2
90 2 16 if ($p1->{'type'} eq ":AT-P-FRAGMENT")
91 0 2 if ($p2->{'type'} eq ":AT-P-FRAGMENT" or $p2->{'type'} eq ":AT-P-TRANSFORM")
94 0 0 unless $p2->{'type'} eq ":AT-P-IMMEDIATE" or $p2->{'type'} eq ":AT-P-VARIABLE" or $p2->{'type'} eq ":AT-P-VARHTML"
99 3 13 if ($p2->{'type'} eq ":AT-P-FRAGMENT")
100 3 0 if ($p1->{'type'} eq ":AT-P-TRANSFORM")
103 0 0 unless $p1->{'type'} eq ":AT-P-IMMEDIATE" or $p1->{'type'} eq ":AT-P-VARIABLE" or $p1->{'type'} eq ":AT-P-VARHTML"
108 0 13 if ($p1->{'type'} eq ":AT-P-VARHTML")
109 0 0 if ($p2->{'type'} eq ":AT-P-VARHTML" or $p2->{'type'} eq ":AT-P-TRANSFORM")
112 0 0 unless $p2->{'type'} eq ":AT-P-IMMEDIATE" or $p2->{'type'} eq ":AT-P-VARIABLE"
116 0 13 if ($p2->{'type'} eq ":AT-P-VARHTML")
117 0 0 if ($p1->{'type'} eq ":AT-P-TRANSFORM")
120 0 0 unless $p1->{'type'} eq ":AT-P-IMMEDIATE" or $p1->{'type'} eq ":AT-P-VARIABLE"
125 5 8 if ($p1->{'type'} eq ":AT-P-TRANSFORM")
126 4 1 if ($p2->{'type'} eq ":AT-P-TRANSFORM")
129 0 1 unless $p2->{'type'} eq ":AT-P-IMMEDIATE" or $p2->{'type'} eq ":AT-P-VARIABLE"
134 0 8 if ($p2->{'type'} eq ":AT-P-TRANSFORM")
135 0 0 unless $p1->{'type'} eq ":AT-P-IMMEDIATE" or $p1->{'type'} eq ":AT-P-VARIABLE"
143 0 79 if @_ < 2
0 79 if @_ > 2
144 58 21 unless defined $p2
145 3 18 unless defined $p1
149 0 35 if @_ < 2
0 35 if @_ > 2
150 20 15 if $aa1->{'type'} eq ":AT-A-REMOVE-ATTR"
151 0 15 if $aa2->{'type'} eq ":AT-A-REMOVE-ATTR"
152 15 0 if ($aa1->{'type'} eq ":AT-A-SET-ATTR")
153 5 10 if ($aa2->{'type'} eq ":AT-A-SET-ATTR")
156 0 10 unless $aa2->{'type'} eq ":AT-A-MODIFY-ATTR"
160 0 0 if ($aa2->{'type'} eq ":AT-A-SET-ATTR")
161 0 0 unless $aa1->{'type'} eq ":AT-A-MODIFY-ATTR"
165 0 0 unless $aa1->{'type'} eq ":AT-A-MODIFY-ATTR" and $aa2->{'type'} eq ":AT-A-MODIFY-ATTR"
170 0 79 if @_ < 2
0 79 if @_ > 2
171 15 64 if ($asa1->{'type'} eq ":AT-AS-REPLACE-ATTRS")
172 15 0 if ($asa2->{'type'} eq ":AT-AS-REPLACE-ATTRS")
176 2 0 keys %{$$asa1{'content'};} <= keys %{$$asa2{'content'};} ? :
3 2 &all(sub { $_->{'type'} eq ':AT-P-IMMEDIATE'; } , values %{$$asa2{'content'};}) ? :
10 5 &all(sub { $_->{'type'} eq ':AT-P-IMMEDIATE'; } , values %{$$asa1{'content'};}) ? :
179 0 0 unless $asa2->{'type'} eq ":AT-AS-MODIFY-ATTRS"
183 0 64 if ($asa2->{'type'} eq ":AT-AS-REPLACE-ATTRS")
184 0 0 unless $asa1->{'type'} eq ":AT-AS-MODIFY-ATTRS"
188 0 64 unless $asa1->{'type'} eq ":AT-AS-MODIFY-ATTRS" and $asa2->{'type'} eq ":AT-AS-MODIFY-ATTRS"
193 35 8 exists $content{$k} ? :
198 0 0 if @_ < 2
0 0 if @_ > 2
199 0 0 defined $act1 && defined $act2 ? :
204 0 79 if @_ < 2
0 79 if @_ > 2
205 0 79 if ($act1->{'type'} eq ":AT-REMOVE-IF")
206 0 0 if ($act2->{'type'} eq ":AT-REMOVE-IF")
211 0 79 if ($act2->{'type'} eq ":AT-REMOVE-IF")
214 0 79 if ($act1->{'type'} eq ":AT-REPLACE-OUTER")
215 0 0 if ($act2->{'type'} eq ":AT-REPLACE-OUTER")
220 0 79 if ($act2->{'type'} eq ":AT-REPLACE-OUTER")
223 0 79 if ($act1->{'type'} eq ":AT-REPEAT-OUTER")
226 0 79 if ($act2->{'type'} eq ":AT-REPEAT-OUTER")
229 0 79 unless $act1->{'type'} eq ":AT-REPLACE-INNER" and $act2->{'type'} eq ":AT-REPLACE-INNER"
243 0 267 if @_ < 2
0 267 if @_ > 2
244 5 262 if ($action->{'type'} eq ':AT-REMOVE-IF') { }
7 255 elsif ($action->{'type'} eq ':AT-REPLACE-OUTER') { }
1 254 elsif ($action->{'type'} eq ':AT-REPEAT-OUTER') { }
252 2 5 if ($param->{'type'} eq ':AT-P-VARIABLE' or $param->{'type'} eq ':AT-P-VARHTML') { }
2 3 elsif ($param->{'type'} eq ':AT-P-TRANSFORM') { }
254 2 0 unless (defined $value->[0])
258 1 1 if (@{$param->{'dynamic'};})
263 1 0 unless (defined $action->{'var'}[0])
267 0 254 unless $action->{'type'} eq ":AT-REPLACE-INNER"
271 0 31 if @_ < 1
0 31 if @_ > 1
272 0 31 defined $var->[0] ? :
280 6 248 if ($asa->{'type'} eq ':AT-AS-REPLACE-ATTRS') { }
286 3 9 if ($value->{'type'} eq ':AT-P-VARIABLE' and not defined $value->{'value'}[0]) { }
294 0 248 unless $asa->{'type'} eq ":AT-AS-MODIFY-ATTRS"
301 7 37 if ($value->{'type'} eq ':AT-A-SET-ATTR' and $value->{'param'}{'type'} eq ':AT-P-VARIABLE' and not defined $value->{'param'}{'value'}[0]) { }
5 32 elsif ($value->{'type'} eq ':AT-A-MODIFY-ATTR' and @{+(my $param = $value->{'param'})->{'dynamic'}}) { }
305 0 5 unless $param->{'type'} eq ":AT-P-TRANSFORM"
323 205 49 if (defined(my $param = $action->{'content'}))
324 36 169 if ($param->{'type'} eq ':AT-P-VARIABLE' || $param->{'type'} eq ':AT-P-VARHTML' and not defined $param->{'value'}[0]) { }
23 146 elsif ($param->{'type'} eq ':AT-P-TRANSFORM' and @{$param->{'dynamic'};}) { }
340 3 251 if (@{$replacement{"repeat"};} = @{$action->{'repeat'};})
342 3 0 unless (defined $$rfirst->{'var'}[0])
348 76 178 if $did_replace
353 0 249 if @_ < 3
360 0 243 if @_ < 2
0 243 if @_ > 2 and (@_ - 2) % 2
0 243 if keys %{__rest}
365 259 273 if ($token->{'type'} eq ':TT-TAG-CLOSE') { }
32 241 elsif ($token->{'type'} eq ':TT-TAG-OPEN') { }
49 384 elsif ($collect_content and $token->{'type'} eq ':TT-TEXT') { }
366 243 16 if $depth == 0
369 16 16 unless $token->{'is_self_closing'}
374 49 194 $collect_content ? :
377 0 266 if @_ < 2
0 266 if @_ > 2
381 0 276 if @_ < 3
0 276 if @_ > 3
390 10 4856 if ($token->{'type'} eq ':TT-DOCTYPE') { }
42 4814 elsif ($token->{'type'} eq ':TT-COMMENT') { }
2175 2639 elsif ($token->{'type'} eq ':TT-TEXT') { }
1093 1546 elsif ($token->{'type'} eq ':TT-TAG-CLOSE') { }
1546 0 elsif ($token->{'type'} eq ':TT-TAG-OPEN') { }
391 9 1 if ($self->{'keep_doctype'})
395 34 8 if ($token->{'content'} =~ /$self->{'keep_comments_re'}/u)
399 3 2172 if ($token->{'content'} =~ /$self->{'dummy_marker_re'}/u)
403 28 2144 if ($cur_tag eq 'script') { }
66 2078 elsif ($cur_tag eq 'style') { }
416 5 1541 if (defined $action and $action->{'type'} eq ":AT-REMOVE-IF")
422 0 5 if @_ > 1
1 4 if @_ < 1
428 1188 358 unless (defined $action)
431 1 1187 if (@bad_attrs)
435 135 1052 if $token->{'is_self_closing'}
439 7 351 if ($action->{'type'} eq ":AT-REPLACE-OUTER")
442 2 5 if ($param->{'type'} eq ':AT-P-IMMEDIATE') { }
1 4 elsif ($param->{'type'} eq ':AT-P-VARIABLE') { }
1 3 elsif ($param->{'type'} eq ':AT-P-FRAGMENT') { }
1 2 elsif ($param->{'type'} eq ':AT-P-VARHTML') { }
451 0 2 unless $param->{'type'} eq ":AT-P-TRANSFORM"
453 2 0 unless ($token->{'is_void'})
454 0 2 $token->{'is_self_closing'} ? :
457 1 1 if (@{$param->{'dynamic'};}) { }
465 5 0 unless $skipped or $token->{'is_self_closing'}
482 1 0 defined $inplace ? :
486 0 1 if @_ > 1
0 1 if @_ < 1
492 0 351 unless $action->{'type'} eq ":AT-REPLACE-INNER"
498 16 335 if ($attrset->{'type'} eq ':AT-AS-REPLACE-ATTRS') { }
502 33 4 if ($param->{'type'} eq ':AT-P-IMMEDIATE') { }
505 0 4 unless $param->{'type'} eq ":AT-P-VARIABLE"
511 0 335 unless $attrset->{'type'} eq ":AT-AS-MODIFY-ATTRS"
526 14 85 if ($attr_action->{'type'} eq ':AT-A-REMOVE-ATTR') { }
39 46 elsif ($attr_action->{'type'} eq ':AT-A-SET-ATTR') { }
531 0 46 unless $attr_action->{'type'} eq ":AT-A-MODIFY-ATTR"
534 0 46 unless $param->{'type'} eq ":AT-P-TRANSFORM"
537 5 41 if (@{$param->{'dynamic'};}) { }
6 35 elsif (not defined $value) { }
550 333 15 if ($param->{'type'} eq ':AT-P-IMMEDIATE') { }
10 5 elsif ($param->{'type'} eq ':AT-P-VARIABLE') { }
551 1 332 if ($param->{'pristine'} and $param->{'value'} =~ /$self->{'dummy_marker_re'}/u)
558 0 5 unless $param->{'type'} eq ":AT-P-TRANSFORM"
564 1 334 if @bad_attrs
582 247 103 if (defined(my $param = $action->{'content'})) { }
42 61 elsif ($token->{'is_self_closing'}) { }
584 0 247 if $token->{'is_void'}
587 157 90 if ($param->{'type'} eq ':AT-P-IMMEDIATE') { }
31 59 elsif ($param->{'type'} eq ':AT-P-VARIABLE') { }
8 51 elsif ($param->{'type'} eq ':AT-P-FRAGMENT') { }
4 47 elsif ($param->{'type'} eq ':AT-P-VARHTML') { }
588 21 136 if ($token->{'name'} eq 'script') { }
1 135 elsif ($token->{'name'} eq 'style') { }
596 18 13 if ($token->{'name'} eq 'script') { }
1 12 elsif ($token->{'name'} eq 'style') { }
604 2 5 if $token->{'name'} eq "script" or $token->{'name'} eq "style" or $token->{'name'} eq "title"
608 2 1 if $token->{'name'} eq "script" or $token->{'name'} eq "style" or $token->{'name'} eq "title"
612 0 47 unless $param->{'type'} eq ":AT-P-TRANSFORM"
614 0 47 $token->{'is_self_closing'} ? :
617 25 22 if (@{$param->{'dynamic'};}) { }
618 18 7 if ($token->{'name'} eq 'script') { }
1 6 elsif ($token->{'name'} eq 'style') { }
626 18 4 if ($token->{'name'} eq 'script') { }
1 3 elsif ($token->{'name'} eq 'style') { }
636 189 0 unless $skipped or $token->{'is_self_closing'}
641 0 42 unless $token->{'is_void'}