Branch Coverage

blib/lib/Text/ANSI/Fold.pm
Criterion Covered Total %
branch 137 162 84.5


line true false branch
106 2 60 if ($Text::VisualWidth::PP::EastAsian) { }
125 0 14 if ($] < "5.016")
200 5 11 if @_
211 101 614 if $_[0]{'linebreak'} & 1
212 96 500 if $_[0]{'linebreak'} & 2
221 2156 14 if (length $_ == 1) { }
227 14 14 if (@s) { }
245 12 51 unless (ref $obj)
248 0 63 if @_ % 2
252 1 102 if ($a eq "tabstyle")
254 0 1 unless my($h, $s) = $b =~ /([-\w]+)/gu
266 0 102 unless exists $obj->{$a}
269 0 63 if (ref $obj->{'discard'} eq "ARRAY")
281 159 34 @reset ? :
298 437 278 unless (ref $obj)
304 0 715 unless &looks_like_number($width) and $width == int $width
306 11 704 if $width <= 0
307 11 704 if $width < 0
308 0 715 unless ($width -= $opt->{'margin'}) > 0
322 328 387 $opt->{'expand'} ? :
331 20 2047 if (s/\A(\r*\n|[\0\x0b\N{U+2028}\N{U+2029}])//u)
336 3 2044 if (/\A(\f+)/pu)
337 1 2 if length $folded
342 2 2042 if (s/\A(\r+)//u)
343 0 2 if (length $_ == 0) { }
354 50 1992 if (s/\A($osc_re)//u)
356 46 4 unless ($obj->{'discard'}{'OSC'})
358 46 0 if ($osc =~ /^(?:\e\]|\x9d)8;[^;]*;(.*?)(?:\e\\|\x9c|\a)$/u)
359 31 15 $1 ne '' ? :
365 1 1991 if (s/\A($erase_re)//u)
366 1 0 unless $obj->{'discard'}{'EL'}
372 159 1832 if (s/\A($reset_re+($erase_re*))//u)
374 0 159 if $2
378 554 1278 if $room < 1
379 124 1154 if ($room < 2 and not $opt->{'splitwide'})
380 16 108 if $room != $width and &_startWideSpacing
383 111 1151 if (@reset)
388 215 1047 if (s/\A($color_re)//u)
395 3 1044 if (s/\A(\e+|$csi_body_re)\z//u)
401 112 932 if ($opt->{'expand'} and s/\A\t//u)
411 4 846 if $w > $room and $room != $width
416 6 840 if $room < 0
417 43 797 if $room < 1
419 62 860 if $bs
422 860 0 if (s/\A(\e+|(?:$unremarkable_re(?!\cH))+)//u) { }
424 387 473 if ((my $w = vwidth($s)) <= $room)
430 0 473 if ($opt->{'splitwide'})
431 0 0 if ($w == $room - 1 and $b =~ /\A\p{IsWideSpacing}/pu) { }
0 0 elsif ($w > $room) { }
442 0 473 if ($w > $room and $room != $width)
456 39 19 if ($word_char_re and my($w2) = /\A( (?: $word_char_re \cH ? ) + )/ux and my($lead, $w1) = $folded =~ m[ \A ## avoid CSI/OSC final char making a word ( (?: [^\e\x9b\x9d]* (?:$csi_re|$osc_re)++ ) *+ .*? ) ( (?: $word_char_re \cH ? ) + ) \z ]ux)
468 31 8 $opt->{'prefix'} eq '' ? :
469 34 5 if ($room + $l < $width - $p and $l + pwidth($w2) <= $width - $p and pwidth($lead) > 0)
480 96 619 if ($_ ne "" and $opt->do_runout)
481 19 6 if ($folded =~ / (? (?! $reset_re) $color_re*+ ) (? (?: ($prohibition_re{'end'}) (?: \cH{1,2} \g{-1})* )+ ) \z /pux and ${^PREMATCH} ne "" and pwidth(${^PREMATCH}) > 0 and (my $w = pwidth($+{'runout'})) <= $opt->{'runout'})
491 2 17 if $+{'color'}
496 46 669 if @reset
503 101 614 if ($opt->do_runin)
513 0 30 if ($m -= $w) < 0
514 2 28 if ($+{'color'})
515 2 28 if ($+{'reset'})
520 26 75 if @runin
523 56 659 if (@color_stack)
525 56 0 if $_ ne ""
527 16 699 if (defined $osc8_link)
529 16 0 if $_ ne ""
532 13 702 if ($opt->{'padding'} and $room > 0)
534 1 12 if (@bg_stack)
540 19 696 if (length $_ and my $p = $opt->{'prefix'})
541 4 15 ref $p eq 'CODE' ? :
554 0 473 if $width <= 0
556 0 473 unless my($left, $right) = $orig =~ /^(\X{0,$width}+)(.*)/u
563 4 83 unless $left =~ s/\X \K ( \X{$trim} ) \z//ux
576 6 3 if (@_ == 0) { }
579 0 3 if @_ > 1
588 21 106 unless defined $_
590 0 106 if length $rest and $rest eq $_
592 80 26 length $rest ? :
603 10 18 if (ref $width eq 'ARRAY') { }
605 2 47 if ($w == 0) { }
43 4 elsif ((my $chop = $obj->retrieve('width', $w)) ne '') { }