enable matching of empty string specs
[catagits/Web-Simple.git] / t / dispatch_parser.t
index caa4e45..8fe2b8e 100644 (file)
@@ -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
 #