added plack server deployment example
[catagits/Web-Simple.git] / t / dispatch_parser.t
index e260565..b1bc859 100644 (file)
@@ -254,6 +254,28 @@ my $dp = Web::Dispatch::Parser->new;
 }
 
 {
+  my $ext = $dp->parse('/foo.bar');
+
+  is_deeply(
+    [ $ext->({ PATH_INFO => '/foo.bar' }) ],
+    [ {} ],
+    '/foo.bar matches /foo.bar'
+  );
+
+  is_deeply(
+    [ $ext->({ PATH_INFO => '/foo.bar.ext' }) ],
+    [ {} ],
+    '/foo.bar matches /foo.bar.ext'
+  );
+
+  is_deeply(
+    [ $ext->({ PATH_INFO => '/foo.notbar' }) ],
+    [],
+    '/foo.bar does not match /foo.notbar'
+  );
+}
+
+{
   my $sub = $dp->parse('/foo/*/...');
 
   is_deeply(
@@ -276,6 +298,16 @@ my $dp = Web::Dispatch::Parser->new;
 }
 
 {
+  my $sub = $dp->parse('/foo/**/belief');
+  my $match = 'barred/beyond';
+  is_deeply(
+    [ $sub->({ PATH_INFO => "/foo/${match}/belief" }) ],
+    [ {}, $match ],
+    "/foo/**/belief matches /foo/${match}/belief"
+  );
+}
+
+{
   my @dot_pairs = (
     [ '/one/*' => 'two' ],
     [ '/one/*.*' => 'two.three' ],