File: number-phone-country-idd.t

package info (click to toggle)
libnumber-phone-perl 3.6006-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 136,072 kB
  • sloc: perl: 2,719; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 641 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl -w

use strict;

use lib 't/inc';
use fatalwarnings;

use Test::More;

END { done_testing(); }

use Number::Phone::Country qw(noexport);

country_and_idd('+44 20 12345678', 'GB', '44', "phone2country_and_idd works for GB");
country_and_idd('212 333 3333',    'US',  '1', "phone2country_and_idd works for US");

sub country_and_idd {
    my ($phone, $exp_country, $exp_idd, $title) = @_;
    subtest $title => sub {
        plan tests => 2;
        my @pair = Number::Phone::Country::phone2country_and_idd($phone);
        is($pair[0], $exp_country, 'country');
        is($pair[1], $exp_idd,     'idd');
    };
    return;
}