~ubuntu-branches/ubuntu/trusty/librouter-simple-perl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/10_routematch.t

  • Committer: Package Import Robot
  • Author(s): Florian Schlichting
  • Date: 2012-06-04 21:31:28 UTC
  • Revision ID: package-import@ubuntu.com-20120604213128-tmi08jxwpq0mnuh5
Tags: upstream-0.09
ImportĀ upstreamĀ versionĀ 0.09

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use strict;
 
2
use warnings;
 
3
use Router::Simple;
 
4
use Test::More;
 
5
 
 
6
my $r = Router::Simple->new();
 
7
$r->connect(
 
8
    'home',
 
9
    '/' => { controller => 'Root', action => 'show' },
 
10
    {
 
11
        method   => 'GET',
 
12
        host     => 'localhost',
 
13
        on_match => sub { 1 }
 
14
    }
 
15
);
 
16
my ( $ret, $route ) = $r->routematch(
 
17
    { HTTP_HOST => 'localhost', REQUEST_METHOD => 'GET', PATH_INFO => '/' }
 
18
);
 
19
is_deeply $route->method, ['GET'];
 
20
is_deeply $route->host, 'localhost';
 
21
is ref($route->on_match), 'CODE';
 
22
 
 
23
done_testing;
 
24