Branch Coverage

blib/lib/HTML/Blitz/RuleSet.pm
Criterion Covered Total %
branch 246 372 66.1


line true false branch
40 0 248 if @_ < 1
0 248 if @_ > 1
49 0 1 if @_ < 2
0 1 if @_ > 2
53 0 4 if @_ < 2
0 4 if @_ > 2
57 0 4 if @_ < 2
0 4 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 14 if @_ < 2
0 14 if @_ > 2
90 0 14 if ($p1->{'type'} eq ":AT-P-FRAGMENT")
91 0 0 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 2 12 if ($p2->{'type'} eq ":AT-P-FRAGMENT")
100 2 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 12 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 12 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 4 8 if ($p1->{'type'} eq ":AT-P-TRANSFORM")
126 4 0 if ($p2->{'type'} eq ":AT-P-TRANSFORM")
129 0 0 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 75 if @_ < 2
0 75 if @_ > 2
144 58 17 unless defined $p2
145 3 14 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 75 if @_ < 2
0 75 if @_ > 2
171 15 60 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 60 if ($asa2->{'type'} eq ":AT-AS-REPLACE-ATTRS")
184 0 0 unless $asa1->{'type'} eq ":AT-AS-MODIFY-ATTRS"
188 0 60 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 75 if @_ < 2
0 75 if @_ > 2
205 0 75 if ($act1->{'type'} eq ":AT-REMOVE-IF")
206 0 0 if ($act2->{'type'} eq ":AT-REMOVE-IF")
211 0 75 if ($act2->{'type'} eq ":AT-REMOVE-IF")
214 0 75 if ($act1->{'type'} eq ":AT-REPLACE-OUTER")
215 0 0 if ($act2->{'type'} eq ":AT-REPLACE-OUTER")
220 0 75 if ($act2->{'type'} eq ":AT-REPLACE-OUTER")
223 0 75 if ($act1->{'type'} eq ":AT-REPEAT-OUTER")
226 0 75 if ($act2->{'type'} eq ":AT-REPEAT-OUTER")
229 0 75 unless $act1->{'type'} eq ":AT-REPLACE-INNER" and $act2->{'type'} eq ":AT-REPLACE-INNER"
243 0 261 if @_ < 2
0 261 if @_ > 2
244 5 256 if ($action->{'type'} eq ':AT-REMOVE-IF') { }
7 249 elsif ($action->{'type'} eq ':AT-REPLACE-OUTER') { }
1 248 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 248 unless $action->{'type'} eq ":AT-REPLACE-INNER"
271 0 30 if @_ < 1
0 30 if @_ > 1
272 0 30 defined $var->[0] ? :
280 6 242 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 242 unless $asa->{'type'} eq ":AT-AS-MODIFY-ATTRS"
301 7 36 if ($value->{'type'} eq ':AT-A-SET-ATTR' and $value->{'param'}{'type'} eq ':AT-P-VARIABLE' and not defined $value->{'param'}{'value'}[0]) { }
5 31 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 201 47 if (defined(my $param = $action->{'content'}))
324 35 166 if ($param->{'type'} eq ':AT-P-VARIABLE' || $param->{'type'} eq ':AT-P-VARHTML' and not defined $param->{'value'}[0]) { }
23 143 elsif ($param->{'type'} eq ':AT-P-TRANSFORM' and @{$param->{'dynamic'};}) { }
340 2 246 if (@{$replacement{"repeat"};} = @{$action->{'repeat'};})
342 2 0 unless (defined $$rfirst->{'var'}[0])
348 74 174 if $did_replace
353 0 244 if @_ < 3
360 0 237 if @_ < 2
0 237 if @_ > 2 and (@_ - 2) % 2
0 237 if keys %{__rest}
365 252 268 if ($token->{'type'} eq ':TT-TAG-CLOSE') { }
30 238 elsif ($token->{'type'} eq ':TT-TAG-OPEN') { }
49 378 elsif ($collect_content and $token->{'type'} eq ':TT-TEXT') { }
366 237 15 if $depth == 0
369 15 15 unless $token->{'is_self_closing'}
374 49 188 $collect_content ? :
377 0 260 if @_ < 2
0 260 if @_ > 2
381 0 273 if @_ < 3
0 273 if @_ > 3
390 9 4802 if ($token->{'type'} eq ':TT-DOCTYPE') { }
38 4764 elsif ($token->{'type'} eq ':TT-COMMENT') { }
2151 2613 elsif ($token->{'type'} eq ':TT-TEXT') { }
1086 1527 elsif ($token->{'type'} eq ':TT-TAG-CLOSE') { }
1527 0 elsif ($token->{'type'} eq ':TT-TAG-OPEN') { }
391 8 1 if ($self->{'keep_doctype'})
395 30 8 if ($token->{'content'} =~ /$self->{'keep_comments_re'}/u)
399 3 2148 if ($token->{'content'} =~ /$self->{'dummy_marker_re'}/u)
403 28 2120 if ($cur_tag eq 'script') { }
66 2054 elsif ($cur_tag eq 'style') { }
416 5 1522 if (defined $action and $action->{'type'} eq ":AT-REMOVE-IF")
422 0 5 if @_ > 1
1 4 if @_ < 1
428 1177 350 unless (defined $action)
431 1 1176 if (@bad_attrs)
435 133 1043 if $token->{'is_self_closing'}
439 7 343 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 343 unless $action->{'type'} eq ":AT-REPLACE-INNER"
498 16 327 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 327 unless $attrset->{'type'} eq ":AT-AS-MODIFY-ATTRS"
526 14 84 if ($attr_action->{'type'} eq ':AT-A-REMOVE-ATTR') { }
38 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 324 15 if ($param->{'type'} eq ':AT-P-IMMEDIATE') { }
10 5 elsif ($param->{'type'} eq ':AT-P-VARIABLE') { }
551 0 324 if ($param->{'pristine'} and $param->{'value'} =~ /$self->{'dummy_marker_re'}/u)
558 0 5 unless $param->{'type'} eq ":AT-P-TRANSFORM"
564 0 327 if @bad_attrs
582 241 102 if (defined(my $param = $action->{'content'})) { }
42 60 elsif ($token->{'is_self_closing'}) { }
584 0 241 if $token->{'is_void'}
587 153 88 if ($param->{'type'} eq ':AT-P-IMMEDIATE') { }
30 58 elsif ($param->{'type'} eq ':AT-P-VARIABLE') { }
7 51 elsif ($param->{'type'} eq ':AT-P-FRAGMENT') { }
4 47 elsif ($param->{'type'} eq ':AT-P-VARHTML') { }
588 20 133 if ($token->{'name'} eq 'script') { }
1 132 elsif ($token->{'name'} eq 'style') { }
596 18 12 if ($token->{'name'} eq 'script') { }
1 11 elsif ($token->{'name'} eq 'style') { }
604 2 4 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 183 0 unless $skipped or $token->{'is_self_closing'}
641 0 42 unless $token->{'is_void'}