);
}
-ok(
- !eval { $dp->parse('GET POST'); 1; },
- "Don't yet allow two methods"
-);
-
{
my $html = $dp->parse('.html');
is_deeply(
[ $html->({ PATH_INFO => '/foo/bar.html' }) ],
- [ { PATH_INFO => '/foo/bar' } ],
+ [ { } ],
'.html matches'
);
is_deeply(
[ $any_ext->({ PATH_INFO => '/foo/bar.html' }) ],
- [ { PATH_INFO => '/foo/bar' }, 'html' ],
+ [ { }, 'html' ],
'.html matches .* and extension returned'
);
[],
'/post/one/ does not match'
);
+
+ is_deeply(
+ [ $post->({ PATH_INFO => '/post/one.html' }) ],
+ [ {}, 'one' ],
+ '/post/one.html still parses out one'
+ );
}
{
is_deeply(
[ $not->({ PATH_INFO => '/foo.xml' }) ],
- [ { PATH_INFO => '/foo' }, 'xml' ],
+ [ {}, 'xml' ],
'!.html+.* matches /foo.xml'
);
);
}
+{
+ 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
#
[ '?:baz=&:evil=' => { baz => 'one two', evil => '/' } ],
[ '?*' => \%all_single ],
[ '?@*' => \%all_multi ],
- [ '?foo=&@*' => 'FOO', do { my %h = %all_multi; delete $h{foo}; \%h } ],
+ [ '?foo=&@*' => 'FOO', \%all_multi ],
[ '?:foo=&@*' => { %all_multi, foo => 'FOO' } ],
[ '?:@bar=&*' => { %all_single, bar => [ qw(BAR1 BAR2) ] } ],
) {
[ '/foo/bar/+?:baz=&:evil=' => { baz => 'one two', evil => '/' } ],
[ '/foo/bar/+?*' => \%all_single ],
[ '/foo/bar/+?@*' => \%all_multi ],
- [ '/foo/bar/+?foo=&@*' => 'FOO', do { my %h = %all_multi; delete $h{foo}; \%h } ],
+ [ '/foo/bar/+?foo=&@*' => 'FOO', \%all_multi ],
[ '/foo/bar/+?:foo=&@*' => { %all_multi, foo => 'FOO' } ],
[ '/foo/bar/+?:@bar=&*' => { %all_single, bar => [ qw(BAR1 BAR2) ] } ],
) {
[ '/foo/bar+?:baz=&:evil=' => { baz => 'one two', evil => '/' } ],
[ '/foo/bar+?*' => \%all_single ],
[ '/foo/bar+?@*' => \%all_multi ],
- [ '/foo/bar+?foo=&@*' => 'FOO', do { my %h = %all_multi; delete $h{foo}; \%h } ],
+ [ '/foo/bar+?foo=&@*' => 'FOO', \%all_multi ],
[ '/foo/bar+?:foo=&@*' => { %all_multi, foo => 'FOO' } ],
[ '/foo/bar+?:@bar=&*' => { %all_single, bar => [ qw(BAR1 BAR2) ] } ],
) {