X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdispatch_parser.t;h=8fe2b8e0169a490edd587446f89e13897dedead0;hb=59ccc1e85596c73f96fce832d900fe72a764f230;hp=caa4e4509a73dfd0fd7f5ee7bfb27299fecb6af5;hpb=052bdd545b13cf685fe09a7e10a7b9d55ef48e45;p=catagits%2FWeb-Simple.git diff --git a/t/dispatch_parser.t b/t/dispatch_parser.t index caa4e45..8fe2b8e 100644 --- a/t/dispatch_parser.t +++ b/t/dispatch_parser.t @@ -8,6 +8,22 @@ use Web::Dispatch::Parser; my $dp = Web::Dispatch::Parser->new; { + my $all = $dp->parse(''); + + is_deeply( + [ $all->({ REQUEST_METHOD => 'GET' }) ], + [ {} ], + 'GET matches' + ); + + is_deeply( + [ $all->({ REQUEST_METHOD => 'POST' }) ], + [ {} ], + 'POST matches' + ); +}; + +{ my $get = $dp->parse('GET'); is_deeply( @@ -259,6 +275,23 @@ my $dp = Web::Dispatch::Parser->new; ); } +{ + my @dot_pairs = ( + [ '/one/*' => 'two' ], + [ '/one/*.*' => 'two.three' ], + [ '/**' => 'one/two' ], + [ '/**.*' => 'one/two.three' ], + ); + + foreach my $p (@dot_pairs) { + is_deeply( + [ $dp->parse($p->[0])->({ PATH_INFO => '/one/two.three' }) ], + [ {}, $p->[1] ], + "${\$p->[0]} matches /one/two.three and returns ${\$p->[1]}" + ); + } +} + # # query string #