Skip to content
Browse files

[URI::Dispatcher] added some more tests

These already pass -- just testing that several named params work
as well as one.
  • Loading branch information...
1 parent cd4683a commit cc3e1f05a7290836220f6ceae13e361d27ec8c6d @masak committed Dec 4, 2010
Showing with 17 additions and 1 deletion.
  1. +17 −1 t/uri-dispatcher/02-named.t
View
18 t/uri-dispatcher/02-named.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 2;
+plan 5;
use URI::Dispatcher;
@@ -16,3 +16,19 @@ use URI::Dispatcher;
ok $d.dispatch('/hello/world'), 'named parameters work';
is $name, 'world', 'the name was captured properly';
}
+
+{
+ my $phrase;
+ my $target;
+
+ my $d = URI::Dispatcher.new(
+ '/say/:phrase/to/:target' => {
+ $phrase = .<phrase> // 'not set';
+ $target = .<target> // 'not set';
+ }
+ );
+
+ ok $d.dispatch('/say/hello/to/world'), 'several named captures';
+ is $phrase, 'hello', 'first capture';
+ is $target, 'world', 'second capture';
+}

0 comments on commit cc3e1f0

Please sign in to comment.
Something went wrong with that request. Please try again.