X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdispatch_parser.t;h=dfaa02655489db7d5bca367d34d05b11a132bb08;hb=8c51c01a7b84bfb5afcd04f15879fbc77f026f1b;hp=b1bc8596ae94c216be97f4a8138eeed37d4d4135;hpb=c2cf05341169b1a51b3b5c00f41eaf0e02862774;p=catagits%2FWeb-Simple.git diff --git a/t/dispatch_parser.t b/t/dispatch_parser.t index b1bc859..dfaa026 100644 --- a/t/dispatch_parser.t +++ b/t/dispatch_parser.t @@ -308,6 +308,29 @@ my $dp = Web::Dispatch::Parser->new; } { + my $match = '/foo...'; + my $sub = $dp->parse($match); + + is_deeply( + [ $sub->({ PATH_INFO => '/foo/bar' }) ], + [ { PATH_INFO => '/bar', SCRIPT_NAME => '/foo' } ], + "$match matches /foo/bar and strips to /bar" + ); + + is_deeply( + [ $sub->({ PATH_INFO => '/foo/' }) ], + [ { PATH_INFO => '/', SCRIPT_NAME => '/foo' } ], + "$match matches /foo/ and strips to /" + ); + + is_deeply( + [ $sub->({ PATH_INFO => '/foo' }) ], + [ { PATH_INFO => '', SCRIPT_NAME => '/foo' } ], + "$match matches /foo and strips to empty path" + ); +} + +{ my @dot_pairs = ( [ '/one/*' => 'two' ], [ '/one/*.*' => 'two.three' ],