File: urn-scheme-exceptions.t

package info (click to toggle)
liburi-perl 5.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 948 kB
  • sloc: perl: 3,936; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 525 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
use warnings;

use Test::More;
use URI::urn;

plan tests => 6;

{
    require URI::_foreign;    # load this before disabling @INC
    my $count = 0;
    local @INC = sub { $count++; return };
    for ( 0 .. 1 ) {
        my $uri = URI->new('urn:asdfasdf:1.2.3.4.5.6.7.8.9.10');
        is( $count, 1, 'only attempt to load the scheme package once' );
        is( $@, '', 'no exception when trying to load a scheme handler class' );
        ok( $uri->isa('URI'), 'but URI still instantiated as foreign' );
    }
}