summaryrefslogtreecommitdiff
path: root/t/rel.t
diff options
context:
space:
mode:
Diffstat (limited to 't/rel.t')
-rw-r--r--t/rel.t21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/rel.t b/t/rel.t
new file mode 100644
index 0000000..104ae5d
--- /dev/null
+++ b/t/rel.t
@@ -0,0 +1,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");
+