MarpaX-ESLIF-URI

 view release on metacpan or  search on metacpan

t/tel.t  view on Meta::CPAN

#!perl -T
use strict;
use warnings FATAL => 'all';
use Test::More;
use Test::Differences;
use Data::Dumper::OneLine qw/Dumper/;

BEGIN {
    use_ok( 'MarpaX::ESLIF::URI' ) || print "Bail out!\n";
}

my %DATA =
  (
   #
   # Adapted from http://www.scottseverance.us/mailto.html
   #
   "Tel:+358-9-123-45678" => {
       scheme         => {              origin => "Tel",              decoded => "Tel",              normalized => "tel" },
       number         => {              origin => "+358-9-123-45678", decoded => "+358-9-123-45678", normalized => "+358912345678"},
       is_global      => 1,
       is_local       => undef,
       has_npdi       => undef,
       has_enumdi     => undef
   },
   "Tel:(4)-5.678;PHONE-CONTEXT=Example.Com" => {
       scheme         => {              origin => "Tel",              decoded => "Tel",              normalized => "tel" },
       number         => {              origin => "(4)-5.678",        decoded => "(4)-5.678",        normalized => "45678"},
       phone_context  => {              origin => "Example.Com",      decoded => "Example.Com",      normalized => "example.com"},
       parameters     =>
       {
           origin     =>   [ { key => "PHONE-CONTEXT", value => "Example.Com" } ],
           decoded    =>   [ { key => "PHONE-CONTEXT", value => "Example.Com" } ],
           normalized =>   [ { key => "phone-context", value => "example.com" } ]
       },
       is_global      => undef,
       is_local       => 1,
       has_npdi       => undef,
       has_enumdi     => undef
   },
   "tel:+1-800-123-4567;CIC=+1-6789" => {
       scheme         => {              origin => "tel",              decoded => "tel",              normalized => "tel" },
       number         => {              origin => "+1-800-123-4567",  decoded => "+1-800-123-4567",  normalized => "+18001234567"},
       cic            => {              origin => "+1-6789",          decoded => "+1-6789",          normalized => "+16789"},
       parameters     =>
       {
           origin     =>   [ { key => "CIC", value => "+1-6789" } ],
           decoded    =>   [ { key => "CIC", value => "+1-6789" } ],
           normalized =>   [ { key => "cic", value => "+16789" } ]
       },
       is_global      => 1,
       is_local       => undef,
       has_npdi       => undef,
       has_enumdi     => undef
   },
   "tel:+1-202-533-1234;npdi;rn=+1-202-544-0000" => {
       scheme         => {              origin => "tel",              decoded => "tel",              normalized => "tel" },
       number         => {              origin => "+1-202-533-1234",  decoded => "+1-202-533-1234",  normalized => "+12025331234"},
       rn             => {              origin => "+1-202-544-0000",  decoded => "+1-202-544-0000",  normalized => "+12025440000"},
       parameters     =>
       {
           origin     =>   [ { key => 'npdi', value => undef }, { key => "rn", value => "+1-202-544-0000" } ],
           decoded    =>   [ { key => 'npdi', value => undef }, { key => "rn", value => "+1-202-544-0000" } ],
           normalized =>   [ { key => 'npdi', value => undef }, { key => "rn", value => "+12025440000" } ]
       },
       is_global      => 1,



( run in 0.421 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )