Branch Coverage

blib/lib/Mojo/Util.pm
Criterion Covered Total %
branch 132 154 85.7


line true false branch
26 0 98 $ENV{'MOJO_NO_CRYPTX'} ? :
106 3 39 if $str =~ /^[A-Z]/u
123 5 23 unless $str =~ /^[A-Z]/u
135 0 0 unless $value =~ /^([^-]+)-([^-]+)-([^-]+)$/u
145 87 7739 unless eval { do { $bytes = _encoding($encoding)->decode("$bytes", 1); 1 } }
151 1 1 $ENV{'MOJO_FATAL_DEPRECATIONS'} ? :
170 25 1 @_ ? :
185 195 45 if (ref $_[0] eq 'ARRAY') { }
196 0 2 unless IO::Uncompress::Gunzip::gunzip(\$compressed, \my $uncompressed)
203 0 59 unless IO::Compress::Gzip::gzip(\$uncompressed, \my $compressed)
215 4 16 if ($value =~ /$QUOTED_VALUE_RE/cgou) { }
15 1 elsif ($value =~ /$UNQUOTED_VALUE_RE/cgou) { }
230 6 13 $size < 0 ? :
232 3 16 if ($size = abs $size) < 1024
233 5 11 if ($size /= 1024) < 1024
234 3 8 if ($size /= 1024) < 1024
235 6 2 if ($size /= 1024) < 1024
241 6 93 unless length $cidr and length $addr
246 2 91 if $v6 xor $addr =~ /:/u
249 36 55 $v6 ? :
2 89 unless $net = inet_pton($v6 ? 10 : 2, $net)
250 35 54 $v6 ? :
2 87 unless $addr = inet_pton($v6 ? 10 : 2, $addr)
251 34 53 $v6 ? :
254 73 14 if defined $mask
268 13 12 if $input =~ s/(.*)\x2d//su
276 146 326 $digit < 64 ? :
279 281 100 $t > 26 ? :
91 381 $t < 1 ? :
280 223 249 if $digit < $t
304 42 24 if $basic > 0
307 42 222 if $m < $n
313 2039 1604 if ($c < $n) { }
264 1340 elsif ($c == $n) { }
320 322 100 $t > 26 ? :
173 422 $t < 1 ? :
321 264 331 if $q < $t
323 173 158 $o < 26 ? :
327 264 0 $q < 26 ? :
349 0 6 unless defined $count and $count =~ /\A\d+\z/a
350 0 6 if (do { &WIN32_API() }) { }
6 0 elsif (-e '/dev/urandom') { }
354 0 0 unless state $genrand = "Win32::API"->new("advapi32", "INT SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength)")
356 0 0 if $count == 0
358 0 0 unless $genrand->Call($buffer, $count)
362 0 6 unless open my $fh, "<:raw", "/dev/urandom"
366 0 0 if not defined $read and $!{'EINTR'}
367 0 6 if not defined $read or $read == 0
382 23 74 if $r
390 6 8 if ($allow_unicode) { }
416 83 93 if $len >= ($spec[$i] // 0)
439 57 369 unless length $1
440 36 1 if $min
446 0 48 unless $str =~ s/^"(.*)"$/$1/gu
455 6287 15 if ($pattern) { }
456 142 6145 unless (exists $PATTERN{$pattern})
458 0 142 unless $PATTERN{$pattern} = eval "sub { \$_[0] =~ s/([$quoted])/sprintf '%%%02X', ord \$1/ge }"
474 1 493 if ref $_[0] and ref $_[0] eq "Mojo::ByteStream"
2009 6705 if ref $_[0] and ref $_[0] eq "Mojo::ByteStream"
494 89 398 $firsttime ? :
511 32 9 !($point =~ /^x/u) ? :
41 962 unless defined $name
517 10 4 if exists $ENTITIES{$name} and !$attr || $name =~ /;$/u || !($last =~ /[A-Za-z0-9=]/u)
532 125 708 if ($expires and $str =~ /\G=\s*$EXPIRES_RE/cgou) { }
42 666 elsif ($str =~ /$QUOTED_VALUE_RE/cgou) { }
563 103 elsif ($str =~ /$UNQUOTED_VALUE_RE/cgou) { }
541 726 107 unless $str =~ /\G[;\s]*,\s*/cgu
547 201 1096 @part ? :
559 1012 456 ref $_[0] eq 'HASH' ? :
1468 349 if @_ == 1
562 80 269 if @_ % 2
565 18 251 ref $_[1] eq 'HASH' ? :
571 12 4 $_[0] < 10 ? :
577 21014 1406 unless @_
580 240 1166 unless @_ > 1 or ref $_[0]
583 23 1143 ref $_[0] ? :
590 0 826 unless my $class = shift()