Skip to content

Commit

Permalink
Bug fix: if libphonenumber doesn't define any formatters for a country,
Browse files Browse the repository at this point in the history
spit out +CC SUBSCRIBER instead of nothing.

Was introduced in ce4e800, see #122
  • Loading branch information
DrHyde committed Mar 6, 2023
1 parent 1db1857 commit 9277ad2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -358,3 +358,4 @@ lib/Number/Phone/StubCountry/InternationalNetworks882.pm
lib/Number/Phone/StubCountry/InternationalNetworks883.pm
lib/Number/Phone/StubCountry/TelecomsForDisasterRelief.pm
lib/Number/Phone/StubCountry/InternationalPremiumRate.pm
t/country-test-bq.t
3 changes: 2 additions & 1 deletion lib/Number/Phone/StubCountry.pm
Expand Up @@ -92,7 +92,8 @@ sub format {
return join(' ', '+'.$self->country_code(), @bits);
}
}
# return '+'.$self->country_code().' '.$number;
# if there's no formatters defined ...
return '+'.$self->country_code().' '.$number;
}

1;
12 changes: 12 additions & 0 deletions t/country-test-bq.t
@@ -0,0 +1,12 @@
use strict;
use warnings;

use Number::Phone;

use Test::More;

my $p = Number::Phone->new("+5997900000");

is($p->format(), "+599 7900000", "Bonaire (BQ) number correctly formatted");

done_testing();

0 comments on commit 9277ad2

Please sign in to comment.