Skip to content

Commit

Permalink
added a few more path matching tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 8, 2011
1 parent 8392c88 commit 912a129
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 40 deletions.
12 changes: 6 additions & 6 deletions lib/Mojo/Content.pm
Expand Up @@ -530,7 +530,7 @@ Get a chunk of the headers starting from a specfic position.
=head2 C<has_leftovers>
my $leftovers = $content->has_leftovers;
my $success = $content->has_leftovers;
Check if there are leftovers.
Expand All @@ -542,32 +542,32 @@ Size of headers in bytes.
=head2 C<is_chunked>
my $chunked = $content->is_chunked;
my $success = $content->is_chunked;
Check if content is chunked.
=head2 C<is_done>
my $done = $content->is_done;
my $success = $content->is_done;
Check if parser is done.
=head2 C<is_dynamic>
my $dynamic = $content->is_dynamic;
my $success = $content->is_dynamic;
Check if content will be dynamic.
Note that this method is EXPERIMENTAL and might change without warning!
=head2 C<is_multipart>
my $multipart = $content->is_multipart;
my $success = $content->is_multipart;
Check if content is multipart.
=head2 C<is_parsing_body>
my $body = $content->is_parsing_body;
my $success = $content->is_parsing_body;
Check if body parsing started yet.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Headers.pm
Expand Up @@ -505,13 +505,13 @@ Shortcut for the C<If-Modified-Since> header.
=head2 C<is_done>
my $done = $headers->is_done;
my $success = $headers->is_done;
Check if header parser is done.
=head2 C<is_limit_exceeded>
my $limit = $headers->is_limit_exceeded;
my $success = $headers->is_limit_exceeded;
Check if a header has exceeded C<max_line_size>.
Note that this method is EXPERIMENTAL and might change without warning!
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -695,8 +695,8 @@ Note that this method is EXPERIMENTAL and might change without warning!
=head2 C<is_running>
my $running = Mojo::IOLoop->is_running;
my $running = $loop->is_running;
my $success = Mojo::IOLoop->is_running;
my $success = $loop->is_running;
Check if loop is running.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/IOLoop/Resolver.pm
Expand Up @@ -393,13 +393,13 @@ implements the following new ones.
=head2 C<is_ipv4>
my $is_ipv4 = $resolver->is_ipv4('127.0.0.1');
my $success = $resolver->is_ipv4('127.0.0.1');
Check if value is a valid C<IPv4> address.
=head2 C<is_ipv6>
my $is_ipv6 = $resolver->is_ipv6('::1');
my $success = $resolver->is_ipv6('::1');
Check if value is a valid C<IPv6> address.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop/Stream.pm
Expand Up @@ -219,7 +219,7 @@ Get handle for stream.
=head2 C<is_finished>
my $finished = $stream->is_finished;
my $success = $stream->is_finished;
Check if stream is in a state where it is safe to close or steal the handle.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOWatcher.pm
Expand Up @@ -211,7 +211,7 @@ Note that this method is EXPERIMENTAL and might change without warning!
=head2 C<is_readable>
my $readable = $watcher->is_readable($handle);
my $success = $watcher->is_readable($handle);
Quick check if a handle is readable, useful for identifying tainted
sockets.
Expand Down
12 changes: 6 additions & 6 deletions lib/Mojo/Log.pm
Expand Up @@ -174,37 +174,37 @@ Log info message.
=head2 C<is_level>
my $is = $log->is_level('debug');
my $success = $log->is_level('debug');
Check log level.
=head2 C<is_debug>
my $is = $log->is_debug;
my $success = $log->is_debug;
Check for debug log level.
=head2 C<is_error>
my $is = $log->is_error;
my $success = $log->is_error;
Check for error log level.
=head2 C<is_fatal>
my $is = $log->is_fatal;
my $success = $log->is_fatal;
Check for fatal log level.
=head2 C<is_info>
my $is = $log->is_info;
my $success = $log->is_info;
Check for info log level.
=head2 C<is_warn>
my $is = $log->is_warn;
my $success = $log->is_warn;
Check for warn log level.
Expand Down
12 changes: 6 additions & 6 deletions lib/Mojo/Message.pm
Expand Up @@ -725,7 +725,7 @@ Get a chunk of start line data starting from a specific position.
=head2 C<has_leftovers>
my $leftovers = $message->has_leftovers;
my $success = $message->has_leftovers;
Check if message parser has leftover data.
Expand All @@ -744,33 +744,33 @@ Message headers, defaults to a L<Mojo::Headers> object.
=head2 C<is_chunked>
my $chunked = $message->is_chunked;
my $success = $message->is_chunked;
Check if message content is chunked.
=head2 C<is_done>
my $done = $message->is_done;
my $success = $message->is_done;
Check if parser is done.
=head2 C<is_dynamic>
my $dynamic = $message->is_dynamic;
my $success = $message->is_dynamic;
Check if message content will be dynamic.
Note that this method is EXPERIMENTAL and might change without warning!
=head2 C<is_limit_exceeded>
my $limit = $message->is_limit_exceeded;
my $success = $message->is_limit_exceeded;
Check if message has exceeded C<max_line_size> or C<max_message_size>.
Note that this method is EXPERIMENTAL and might change without warning!
=head2 C<is_multipart>
my $multipart = $message->is_multipart;
my $success = $message->is_multipart;
Check if message content is multipart.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -449,13 +449,13 @@ Make sure message has all required headers for the current HTTP version.
=head2 C<is_secure>
my $secure = $req->is_secure;
my $success = $req->is_secure;
Check if connection is secure.
=head2 C<is_xhr>
my $xhr = $req->is_xhr;
my $success = $req->is_xhr;
Check C<X-Requested-With> header for C<XMLHttpRequest> value.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Message/Response.pm
Expand Up @@ -234,7 +234,7 @@ Make sure message has all required headers for the current HTTP version.
=head2 C<is_status_class>
my $is_2xx = $res->is_status_class(200);
my $success = $res->is_status_class(200);
Check response status class.
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Transaction.pm
Expand Up @@ -223,19 +223,19 @@ Parser errors and codes.
=head2 C<is_done>
my $done = $tx->is_done;
my $success = $tx->is_done;
Check if transaction is done.
=head2 C<is_websocket>
my $is_websocket = $tx->is_websocket;
my $success = $tx->is_websocket;
Check if transaction is a WebSocket.
=head2 C<is_writing>
my $writing = $tx->is_writing;
my $success = $tx->is_writing;
Check if transaction is writing.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -461,7 +461,7 @@ Finish the WebSocket connection gracefully.
=head2 C<is_websocket>
my $is_websocket = $ws->is_websocket;
my $success = $ws->is_websocket;
True.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/URL.pm
Expand Up @@ -425,7 +425,7 @@ Host part of this URL in punycode format.
=head2 C<is_abs>
my $is_abs = $url->is_abs;
my $success = $url->is_abs;
Check if URL is absolute.
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojolicious/Routes.pm
Expand Up @@ -829,21 +829,21 @@ See also the L<Mojolicious::Lite> tutorial for more argument variations.
=head2 C<has_conditions>
my $has_conditions = $r->has_conditions;
my $success = $r->has_conditions;
Returns true if this route contains conditions.
Note that this method is EXPERIMENTAL and might change without warning!
=head2 C<has_custom_name>
my $has_custom_name = $r->has_custom_name;
my $success = $r->has_custom_name;
Returns true if this route has a custom user defined name.
Note that this method is EXPERIMENTAL and might change without warning!
=head2 C<has_websocket>
my $has_websocket = $r->has_websocket;
my $success = $r->has_websocket;
Returns true if this route has a WebSocket ancestor.
Note that this method is EXPERIMENTAL and might change without warning!
Expand All @@ -856,13 +856,13 @@ Hide controller method or attribute from routes.
=head2 C<is_endpoint>
my $is_endpoint = $r->is_endpoint;
my $success = $r->is_endpoint;
Returns true if this route qualifies as an endpoint.
=head2 C<is_websocket>
my $is_websocket = $r->is_websocket;
my $success = $r->is_websocket;
Returns true if this route is a WebSocket.
Note that this method is EXPERIMENTAL and might change without warning!
Expand Down
6 changes: 5 additions & 1 deletion t/mojo/path.t
Expand Up @@ -3,7 +3,7 @@ use Mojo::Base -strict;

use utf8;

use Test::More tests => 117;
use Test::More tests => 120;

# "This is the greatest case of false advertising I’ve seen since I sued the
# movie 'The Never Ending Story.'"
Expand Down Expand Up @@ -150,3 +150,7 @@ is $path->match('/foo♥'), undef, 'no match';
$path = Mojo::Path->new('/');
is $path->match('/'), 1, 'match';
is $path->match('/foo'), undef, 'no match';
$path = Mojo::Path->new('/0');
is $path->match('/'), 1, 'match';
is $path->match('/0'), 1, 'match';
is $path->match('/0/0'), undef, 'no match';

0 comments on commit 912a129

Please sign in to comment.