Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more path merging tests
  • Loading branch information
kraih committed May 12, 2012
1 parent b750b7d commit f1de874
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/HTML.pm
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Message/Response.pm
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Path.pm
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion t/mojo/path.t
Expand Up @@ -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.'"
Expand Down Expand Up @@ -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('//');
Expand Down

0 comments on commit f1de874

Please sign in to comment.