Merge branch captures_and_args_combined
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_uri_for_action.t
index c8925d8..c95f978 100644 (file)
@@ -6,9 +6,7 @@ use warnings;
 use FindBin;
 use lib "$FindBin::Bin/../lib";
 
-use Test::More;
-
-plan tests => 39;
+use Test::More 0.88;
 
 use_ok('TestApp');
 
@@ -21,8 +19,6 @@ my $private_action = $dispatcher->get_action_by_path(
                        '/class_forward_test_method'
                      );
 
-warn $dispatcher->uri_for_action($private_action);
-
 ok(!defined($dispatcher->uri_for_action($private_action)),
    "Private action returns undef for URI");
 
@@ -56,6 +52,21 @@ is($dispatcher->uri_for_action($regex_action, [ 'foo', 123 ]),
    "/action/regexp/foo/123",
    "Regex action interpolates captures correctly");
 
+my $regex_action_bs = $dispatcher->get_action_by_path(
+                     '/action/regexp/one_backslashes'
+                   );
+
+ok(!defined($dispatcher->uri_for_action($regex_action_bs)),
+   "Regex action without captures returns undef");
+
+ok(!defined($dispatcher->uri_for_action($regex_action_bs, [ 1, 2, 3 ])),
+   "Regex action with too many captures returns undef");
+
+is($dispatcher->uri_for_action($regex_action_bs, [ 'foo', 123 ]),
+   "/action/regexp/foo/123.html",
+   "Regex action interpolates captures correctly");
+
+
 #
 #   Index Action
 #
@@ -212,3 +223,5 @@ is($context->uri_for($chained_action, [ 1 ], 2, { q => 1 }),
 
 }
 
+done_testing;
+