Branch Coverage

lib/Locale/Unicode.pm
Criterion Covered Total %
branch 181 396 45.7


line true false branch
493 0 89 if (scalar @args == 1 and defined $args[0] and ref $args[0] eq 'HASH') { }
0 89 elsif (scalar(@args) % 2) { }
499 0 0 if exists $opts->{'fatal'}
509 1 1 if ($args[$i] eq "fatal")
517 73 16 if (index($locale, "-") != -1 or index($locale, "_") != -1)
524 1 88 unless scalar keys %$ref
525 0 88 unless $self->apply($ref)
533 0 1 if (not defined $meth) { }
0 1 elsif (not defined &$meth($self, $val)) { }
539 0 0 if (defined $val and $self->error)
552 0 88 unless scalar keys %$hash
555 14 172 if $prop eq "transform_ext" or $prop eq "unicode_ext"
557 12 160 unless ($code = $Locale::Unicode::PROP_TO_SUB->{$prop})
560 0 12 unless ($code)
562 0 0 if warnings::enabled()
575 35 48 if $self->{'_cache_value'} and not length($self->{'_reset'} // "")
644 240 1536 if (ref $ref->{$tag} eq 'HASH') { }
654 36 1740 unless ($code = $Locale::Unicode::PROP_TO_SUB->{$tag})
661 1759 17 unless defined $val
662 10 7 unless exists $result->{$prefix}
663 0 17 if (exists $def->{'type'} and $def->{'type'} eq 'boolean') { }
667 0 0 $val ? :
0 0 $val ? :
0 0 $Locale::Unicode::EXPLICIT_BOOLEAN ? :
679 9 39 if (my $transform_locale = $self->transform_locale) { }
0 39 elsif (exists $result->{'t'} and ref $result->{'t'} eq 'ARRAY' and scalar @{$result->{'t'};}) { }
689 0 0 if warnings::enabled()
694 13 83 if (exists $result->{$pref})
699 2 46 if (my $private = $self->private)
712 2 4 if (@_)
715 2 0 unless (builtin::blessed($base) and $base->isa("Locale::Unicode"))
722 2 0 if (my $lang = $base->language_id) { }
731 0 2 if (my $script = $base->script) { }
740 2 0 if (my $territory = $base->territory) { }
742 0 2 unless $self->territory($territory)
751 1 1 if ($ref = $base->variants and ref($ref // '') eq 'ARRAY' and scalar @$ref) { }
782 0 3 if (my $privateuse = $clone->privateuse) { }
0 3 elsif (my $grandfathered = $clone->grandfathered) { }
791 1 2 if (my $variant = $self->variant)
802 1 0 if $variant2 ne $variant
807 1 2 if (my $country_code = $self->country_code)
810 1 0 if $cc ne $country_code
813 1 2 if (my $script = $self->script)
816 1 0 if $script2 ne $script
820 3 0 if ($lang = $self->language or $lang3 = $self->language3) { }
832 3 0 if ($lang) { }
0 0 elsif ($lang3) { }
835 1 2 if ($lang_canon eq 'root') { }
0 2 elsif ($lang_canon ne $lang) { }
847 0 0 if $lang_canon ne $lang3
949 1 60 if (my $privateuse = $self->privateuse) { }
2 58 elsif (my $grandfathered = $self->grandfathered) { }
959 48 10 if (my $lang = $self->language) { }
10 0 elsif (my $lang3 = $self->language3) { }
973 4 54 if (my $extended = $self->extended)
978 15 43 if (my $script = $self->script)
983 26 32 if (my $cc = $self->country_code) { }
0 32 elsif (my $region = $self->region) { }
992 10 48 if (my $variant = $self->variant)
1039 1 0 if (@_)
1041 0 1 ref $_ eq 'CODE' ? :
1046 1 0 if ($self->fatal) { }
1052 0 0 if warnings::enabled()
1053 0 0 if want("OBJECT")
1057 0 0 ref $self ? :
1075 2 63 if (@_)
1079 0 2 if (not defined $val) { }
1 1 elsif ($val =~ /^$Locale::Unicode::GRANDFATHERED_IRREGULAR$/) { }
1 0 elsif ($val =~ /^$Locale::Unicode::GRANDFATHERED_REGULAR$/) { }
1094 0 0 if warnings::enabled()
1204 4 1 if (my $lang = $self->language) { }
1 0 elsif (my $lang3 = $self->language3) { }
1213 2 3 if (my $ext = $self->extended)
1225 2 2 if (@_)
1228 0 2 if (not defined $val) { }
0 2 elsif (length $val == 3) { }
1278 1199 1 if ($lang =~ /^$Locale::Unicode::LOCALE_RE$/)
1284 0 1 wantarray ? :
1297 0 2 if (scalar @_ != 1)
1302 0 2 unless (builtin::blessed($other) and $other->isa("Locale::Unicode"))
1308 58 20 unless exists $Locale::Unicode::PROP_TO_SUB->{$_}
1311 2 72 if $prop eq "variant"
1312 6 66 if (exists $other->{$prop} and defined $other->{$prop})
1319 2 0 if ($ref = $other->variants and scalar @$ref)
1323 1 1 if (scalar @$orig) { }
1371 0 104 unless defined $opts
1375 1 103 unless $re
1378 4 0 if (exists $re->{'root'} and defined $re->{'root'} and length $re->{'root'})
1387 0 1133 if (exists $opts->{$prop}) { }
168 965 elsif (exists $re->{$prop} and defined $re->{$prop} and length $re->{$prop}) { }
1399 103 0 if (exists $re->{'locale_bcp47'} and defined $re->{'locale_bcp47'} and length $re->{'locale_bcp47'})
1404 25 78 if substr($this, $offset, 1) eq "-"
1408 16 0 if (exists $re->{'ext_transform'} and defined $re->{'ext_transform'} and length $re->{'ext_transform'} or exists $re->{'transform_options'} and defined $re->{'transform_options'} and length $re->{'transform_options'})
1416 16 0 if (exists $re->{'ext_transform'} and defined $re->{'ext_transform'}) { }
0 0 elsif (exists $re->{'transform_options'} and defined $re->{'transform_options'}) { }
1424 10 6 if (length $re->{'ext_transform'} > $offset and substr($re->{'ext_transform'}, $offset, 1) eq "-")
1444 0 15 if (exists $info->{$n}) { }
0 15 elsif (not $self->can($n)) { }
1446 0 0 if warnings::enabled()
1450 0 0 if warnings::enabled()
1457 9 0 if (exists $re->{'ext_unicode'} and defined $re->{'ext_unicode'} and length $re->{'ext_unicode'} or exists $re->{'collation_options'} and defined $re->{'collation_options'} and length $re->{'collation_options'})
1467 9 0 if substr($re->{'ext_unicode'}, 0, 2) eq "u-"
1474 0 17 if (exists $info->{$n}) { }
0 17 elsif (not $self->can($n)) { }
1476 0 0 if warnings::enabled()
1480 0 0 if warnings::enabled()
1487 0 0 if (exists $re->{'extension'} and defined $re->{'extension'} and length $re->{'extension'})
1507 4 0 if (exists $re->{'private_extension'} and defined $re->{'private_extension'} and length $re->{'private_extension'})
1523 0 0 if (scalar @_)
1527 0 0 if (scalar @_ == 1 and ref $_[0] eq 'HASH') { }
1533 0 0 if (scalar @_ > 1 and ref $_[-1] eq "HASH")
1540 0 0 if not defined $err and exists $opts->{'error'} and defined $opts->{'error'} and length $opts->{'error'}
1542 0 0 if exists $opts->{'class'} and defined $opts->{'class'} and length $opts->{'class'}
1543 0 0 if exists $opts->{'code'} and defined $opts->{'code'} and length $opts->{'code'}
1548 0 0 if (not defined $err and !scalar(@_) || defined $class) { }
0 0 elsif (defined $err and builtin::blessed($err) and scalar @_ == 1 || scalar @_ == 2 && defined $class) { }
1551 0 0 length ${$pack . '::ERROR';} ? :
0 0 ref $self ? :
1552 0 0 if (not defined $error) { }
1558 0 0 defined $class ? :
1559 0 0 if defined $code
1568 0 0 defined $class ? :
1569 0 0 if defined $code and $self->{'error'}->can("code")
1571 0 0 if ($self->{'fatal'} or defined ${"${class}::FATAL_EXCEPTIONS";} and ${"${class}::FATAL_EXCEPTIONS";})
1582 0 0 if (want("OBJECT"))
1617 88 122 if (not length($self->{'_reset'} // "") and scalar @_)
1656 2 9 if (@_)
1659 2 0 if (defined $val) { }
1661 2 0 if ($val =~ /^([a-zA-Z]{2})$/) { }
0 0 elsif ($val =~ /^(\d{3})$/) { }
1692 3 2 if (@_)
1695 3 0 if (defined $val)
1697 2 1 unless (builtin::blessed($val) and $val->isa(ref $self || $self))
1702 0 2 unless $core eq $locale
1731 0 1 unless (defined $def->{'tz'} and length($def->{'tz'} // ""))
1746 0 1 if (not defined $def) { }
0 1 elsif (not $def) { }
1754 1 0 if exists $def->{'alias'} and (ref $def->{'alias'} || '') eq "ARRAY"
1763 0 3 unless exists $Locale::Unicode::TZ_DICT->{$id}
1773 0 1 unless (exists $Locale::Unicode::TZ_NAME2ID->{$name} and defined $Locale::Unicode::TZ_NAME2ID->{$name} and length($Locale::Unicode::TZ_NAME2ID->{$name} // ""))
1795 4 2 if (my $variant = $self->variant)
1814 1194 1666 if (ref $field eq "HASH")
1818 344 850 if (exists $def->{'regexp'} and defined $def->{'regexp'} and ref $def->{'regexp'} eq 'Regexp') { }
240 610 elsif (exists $def->{'type'} and defined $def->{'type'} and length $def->{'type'}) { }
1830 68 0 if (exists $def->{'isa'} and defined $def->{'isa'} and length $def->{'isa'})
1836 542 0 if (exists $def->{'on_update'} and defined $def->{'on_update'} and ref $def->{'on_update'} eq "CODE")
1843 204 2656 if (@_)
1846 201 3 if (defined $val and length $val)
1849 0 201 if (defined $re and not $val =~ /^$re$/) { }
0 201 elsif (defined $type and $type eq 'boolean') { }
12 189 elsif (defined $isa) { }
1858 0 0 if ($val =~ /^(?:yes|no)$/i) { }
0 0 elsif ($val =~ /^(?:true|false)$/i) { }
0 0 elsif ($val =~ /^(?:1|0)$/) { }
1861 0 0 $val eq 'yes' ? :
1866 0 0 $val eq 'true' ? :
1871 0 0 $val ? :
1875 0 0 if warnings::enabled()
1876 0 0 $val ? :
1881 0 12 if (not builtin::blessed($val) or builtin::blessed($val) and not $val->isa($isa))
1888 126 75 if (defined $on_update)
1892 0 126 if ($@)
1901 1 2859 if want("OBJECT")
1903 2395 464 unless defined $self->{$field}
1911 88 104 if (scalar @_ == 1 and defined $_[0] and (ref $_[0] || '') eq 'HASH') { }
104 0 elsif (not scalar(@_) % 2) { }
3569 0 0 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
3583 0 0 scalar @args == 1 && ref $args[0] eq 'ARRAY' ? :
3584 0 0 defined $ref && ref $ref eq 'ARRAY' && scalar @$ref > 1 ? :
3585 0 0 ref $ref eq 'ARRAY' ? :
3588 0 0 if (ref $self) { }
3627 0 0 $_[0] ? :
3633 0 0 unless (ref $self)
3646 0 0 if $_[0]
3648 0 0 if not $_[0]
3659 0 0 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
3674 0 0 if (scalar @args == 1 and ref $args[0] eq 'ARRAY') { }
3684 0 0 if (ref $self) { }
3700 0 0 $_[0] ? :
3728 1 0 if (scalar @_ == 1) { }
3730 1 0 if ((ref $_[0] || '') eq 'HASH') { }
0 0 elsif (ref $_[0] and $_[0]->isa('Locale::Unicode::Exception')) { }
3733 1 0 if ($args->{'skip_frames'})
3741 1 6 if exists $args->{$k}
3759 0 0 ref $_ eq 'CODE' ? :
3770 0 0 if $self->{'_cache_value'} and not length($self->{'_reset'} // "")
3799 0 0 if (defined $file and defined $line)
3812 0 0 if (not length($self->{'_reset'} // "") and scalar @_)
3822 0 0 unless ref $self
3832 0 0 if (@_) { }
3853 0 0 if @_
3865 0 0 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
3879 0 0 scalar @args == 1 && ref $args[0] eq 'ARRAY' ? :
3880 0 0 defined $ref && ref $ref eq 'ARRAY' && scalar @$ref > 1 ? :
3881 0 0 ref $ref eq 'ARRAY' ? :
3884 0 0 if (ref $self) { }
3921 0 0 @_ ? :
3929 0 0 if (want("OBJECT"))