File: rel.t

package info (click to toggle)
liburi-perl 1.64-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 608 kB
  • ctags: 303
  • sloc: perl: 4,914; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 552 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
#!/usr/bin/perl -w

use strict;
use warnings;

use Test;

plan tests => 6;

use URI;

my $uri;

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

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