File: rel.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 (21 lines) | stat: -rw-r--r-- 541 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
use strict;
use warnings;

use Test::More;

plan tests => 6;

use URI ();

my $uri;

$uri = URI->new("http://www.example.com/foo/bar/");
is($uri->rel("http://www.example.com/foo/bar/"), "./");
is($uri->rel("HTTP://WWW.EXAMPLE.COM/foo/bar/"), "./");
is($uri->rel("HTTP://WWW.EXAMPLE.COM/FOO/BAR/"), "../../foo/bar/");
is($uri->rel("HTTP://WWW.EXAMPLE.COM:80/foo/bar/"), "./");

$uri = URI->new("http://www.example.com/foo/bar");
is($uri->rel("http://www.example.com/foo/bar"), "bar");
is($uri->rel("http://www.example.com/foo"), "foo/bar");