Skip to content

Commit

Permalink
better base URL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 25, 2012
1 parent 84b1d53 commit 26ae8d0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions t/mojo/url.t
Expand Up @@ -203,14 +203,15 @@ is $rel->to_abs, 'http://kraih.com/a/b/c/d/index.html',
'right absolute version';
is $rel->to_abs->to_rel, 'c/d/index.html', 'right relative version';
$url = Mojo::URL->new('/foo');
ok !$url->base->is_abs, 'right base';
ok $url->to_abs(Mojo::URL->new('http://kraih.com'))->base->is_abs,
is $url->base, '', 'no base';
is $url->to_abs(Mojo::URL->new('http://kraih.com'))->base, 'http://kraih.com',
'right base';
$url = Mojo::URL->new('http://kraih.com/foo');
ok !$url->base->is_abs, 'right base';
ok $url->to_rel(Mojo::URL->new('http://kraih.com'))->base->is_abs,
is $url->base, '', 'no base';
is $url->to_rel(Mojo::URL->new('http://kraih.com'))->base, 'http://kraih.com',
'right base';


# Relative path
$url = Mojo::URL->new('http://kraih.com/foo/?foo=bar#23');
$url->path('bar');
Expand Down

0 comments on commit 26ae8d0

Please sign in to comment.