File: find-right-subclass.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 (32 lines) | stat: -rw-r--r-- 929 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
27
28
29
30
31
32
#!/usr/bin/perl -w

use Test::More;
use Scalar::Util qw(blessed);

END { done_testing(); }

use Number::Phone;

use lib 't/inc';
use fatalwarnings;

my $number = Number::Phone->new("+441234567890");
ok(blessed($number) && $number->isa('Number::Phone::UK'),
    "N::P->new() works without specifically loading a country module");

$number = Number::Phone->new("+12265550199");
ok(blessed($number) && $number->isa('Number::Phone::NANP::CA'),
    "... and it even works for the NANP!");

$number = Number::Phone->new("+18666232282");
ok(blessed($number) && $number->isa('Number::Phone::NANP'),
    "... and it even works for the non-geographic NANP!");

# +999 is "Proposed disaster relief (TDR) service", NYI by N::P::Country
ok(
    !blessed(Number::Phone->new("+999123")) &&
    !defined(Number::Phone->new("+999123")),
    "A country code not recognised by N::P::Country returns false"
);

# FIXME - Kazakhstan/Russia weirdness