File: 01-smart-uris.t

package info (click to toggle)
liburi-smarturi-perl 0.031-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 188 kB
  • sloc: perl: 2,144; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 874 bytes parent folder | download
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
#!perl

use strict;
use warnings;
use Test::More tests => 8;

use URI::SmartURI;
use URI;

my $uri = URI::SmartURI->new('http://www.catalystframework.org/calendar',
    { reference => 'http://www.catalystframework.org/' }
);

is($uri, 'http://www.catalystframework.org/calendar', 'stringification');

is($uri->hostless, '/calendar', '$uri->hostless');

ok($uri->hostless->eq('/calendar'), '$uri->eq 1');
ok($uri->hostless->eq(URI::SmartURI->new('/calendar', 'http')), '$uri->eq 2');
ok($uri->hostless->eq(URI->new('/calendar', 'http')), '$uri->eq 3');

is($uri->relative, 'calendar', '$uri->relative');

is($uri->absolute, 'http://www.catalystframework.org/calendar', '$uri->absolute');

is(
    $uri->relative->absolute->hostless->relative->absolute,
    'http://www.catalystframework.org/calendar',
    'sticky reference URI'
);

# vim: expandtab shiftwidth=4 ts=4 tw=80: