X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdispatch_parser.t;h=d0b8db46d03a37c18331c6dcad3739da80f9ce52;hb=aaa598e6eb2a284ce1984715e6caade20590da34;hp=caa4e4509a73dfd0fd7f5ee7bfb27299fecb6af5;hpb=052bdd545b13cf685fe09a7e10a7b9d55ef48e45;p=catagits%2FWeb-Simple.git diff --git a/t/dispatch_parser.t b/t/dispatch_parser.t index caa4e45..d0b8db4 100644 --- a/t/dispatch_parser.t +++ b/t/dispatch_parser.t @@ -7,6 +7,27 @@ use Web::Dispatch::Parser; my $dp = Web::Dispatch::Parser->new; +TODO: { + local $TODO = 'according to the synopsis this should work'; + my $all = eval { + $dp->parse(''); + }; + ok $all; + eval { + is_deeply( + [ $all->({ REQUEST_METHOD => 'GET' }) ], + [ {} ], + 'GET matches' + ); + + is_deeply( + [ $all->({ REQUEST_METHOD => 'POST' }) ], + [ {} ], + 'POST matches' + ); + }; +}; + { my $get = $dp->parse('GET'); @@ -259,6 +280,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 #