Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 886dde7be8
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (29 sloc) 0.955 kb
use v6;
use Test;
plan 9;
use Routes;
ok 1, 'We use Routes and we are still alive';
use Routes::Route;
ok 1, 'We use Routes::Route and we are still alive';
my $r =;
dies_ok { $r.add: },
'.add adds only complete Route objects';
$r.add: pattern => '', code => { "Krevedko" } );
is $r.dispatch(['']),
"Root pattern [''] works";
ok $r.add( ['foo', 'bar'], { "Yay" } ),
'.add(@pattern, $code) -- shortcut for adding a Route object';
nok $r.dispatch(['foo']),
'Routes returns False if it can\'t find matched Route and does not have a default';
is $r.dispatch(['foo', 'bar']),
"Dispatch to Route ['foo', 'bar'])";
$r.default = { "Woow" };
is $r.dispatch(['foo', 'bar', 'baz']),
'Dispatch to default, when have no matched Route';
is $r.dispatch(['foo', 'bar']),
"Dispatch ['foo', 'bar'] again";
# vim:ft=perl6
Jump to Line
Something went wrong with that request. Please try again.