1use Test::More;
2use Test::HTTP::Router;
3use HTTP::Router;
4
5my $r = HTTP::Router->new;
6$r->add_route('/bar', params => { action => 'path' });
7$r->add_route(
8    '/{year}',
9    conditions => { year => qr/^\d{4}$/ },
10    params     => { action => 'by_year' }
11);
12$r->add_route('/{user_id}', params => { action => 'capture' });
13$r->freeze;
14
15is @{[ $r->routes ]} => 3;
16
17path_ok $r, '/2009';
18params_ok $r, '/2009', { action => 'by_year', year => 2009 };
19
20path_ok $r, '/foo';
21params_ok $r, '/foo', { action => 'capture', user_id => 'foo' };
22
23path_ok $r, '/bar';
24params_ok $r, '/bar', { action => 'path' };
25
26done_testing;
27