From f1de87466b31b6ce3a2b65be6fea100a5689a09c Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Sat, 12 May 2012 22:44:47 +0200 Subject: [PATCH] more path merging tests --- lib/Mojo/DOM/HTML.pm | 2 +- lib/Mojo/Message/Response.pm | 2 +- lib/Mojo/Path.pm | 2 +- t/mojo/path.t | 7 ++++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/Mojo/DOM/HTML.pm b/lib/Mojo/DOM/HTML.pm index 6610e689fd..4b10827fc0 100644 --- a/lib/Mojo/DOM/HTML.pm +++ b/lib/Mojo/DOM/HTML.pm @@ -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 diff --git a/lib/Mojo/Message/Response.pm b/lib/Mojo/Message/Response.pm index 4856e363cb..e78673f98c 100644 --- a/lib/Mojo/Message/Response.pm +++ b/lib/Mojo/Message/Response.pm @@ -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'; diff --git a/lib/Mojo/Path.pm b/lib/Mojo/Path.pm index 3d656b6b28..a6fc4ef312 100644 --- a/lib/Mojo/Path.pm +++ b/lib/Mojo/Path.pm @@ -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; diff --git a/t/mojo/path.t b/t/mojo/path.t index ac2e1e0c3d..e40cfa8d1a 100644 --- a/t/mojo/path.t +++ b/t/mojo/path.t @@ -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('//');