Permalink
Browse files

more path merging tests

  • Loading branch information...
1 parent b750b7d commit f1de87466b31b6ce3a2b65be6fea100a5689a09c @kraih committed May 12, 2012
Showing with 9 additions and 4 deletions.
  1. +1 −1 lib/Mojo/DOM/HTML.pm
  2. +1 −1 lib/Mojo/Message/Response.pm
  3. +1 −1 lib/Mojo/Path.pm
  4. +6 −1 t/mojo/path.t
View
@@ -115,7 +115,7 @@ sub parse {
if ($tag =~ $END_RE) { $self->_end($cs ? $1 : lc($1), \$current) }
# Start
- elsif ($tag =~ qr#([^\s/]+)([\s\S]*)#) {
+ elsif ($tag =~ m#([^\s/]+)([\s\S]*)#) {
my ($start, $attr) = ($cs ? $1 : lc($1), $2);
# Attributes
@@ -136,7 +136,7 @@ sub _parse_start_line {
# We have a full HTTP 1.0+ response line
return unless defined(my $line = get_line \$self->{buffer});
return $self->error('Bad response start line.')
- unless $line =~ qr|^\s*HTTP/(\d\.\d)\s+(\d\d\d)\s*(.+)?$|;
+ unless $line =~ m|^\s*HTTP/(\d\.\d)\s+(\d\d\d)\s*(.+)?$|;
$self->version($1)->code($2)->message($3);
$self->content->auto_relax(1);
$self->{state} = 'content';
View
@@ -65,7 +65,7 @@ sub merge {
my ($self, $path) = @_;
# Replace
- return $self->parse($path) if $path =~ qr|^/|;
+ return $self->parse($path) if $path =~ m|^/|;
# Merge
pop @{$self->parts} unless $self->trailing_slash;
View
@@ -2,7 +2,7 @@ use Mojo::Base -strict;
use utf8;
-use Test::More tests => 203;
+use Test::More tests => 206;
# "This is the greatest case of false advertising I’ve seen since I sued the
# movie 'The Never Ending Story.'"
@@ -196,6 +196,11 @@ $path->merge('/bar/baz/');
is "$path", '/bar/baz/', 'right path';
ok $path->leading_slash, 'has leading slash';
ok $path->trailing_slash, 'has trailing slash';
+$path = Mojo::Path->new('/foo/bar');
+$path->merge(Mojo::Path->new('baz/yada'));
+is "$path", '/foo/baz/yada', 'right path';
+ok $path->leading_slash, 'has leading slash';
+ok !$path->trailing_slash, 'no trailing slash';
# Empty path elements
$path = Mojo::Path->new('//');

0 comments on commit f1de874

Please sign in to comment.