optional PathPart and PathPart+Args tests for ChildOf
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / ChildOf.pm
index a244a98..24fe369 100644 (file)
@@ -8,6 +8,13 @@ use base qw/Catalyst::Controller/;
 sub begin :Private { }
 
 #
+#   TODO
+#   :ChildOf('') defaulting to controller namespace
+#   :ChildOf('..') defaulting to action in controller above
+#   :ChildOf == ChildOf('/')
+#
+
+#
 #   Simple parent/child action test
 #
 sub foo  :PathPart('childof/foo')  :Captures(1) :ChildOf('/') { }
@@ -23,7 +30,7 @@ sub endpoint2 :PathPart('end2') :ChildOf('/action/childof/foo2') :Args(2) { }
 #   Relative specification of parent action
 #
 sub bar :PathPart('childof/bar') :ChildOf('/') :Captures(0) { }
-sub finale :ChildOf('bar') :Args { }
+sub finale :PathPart('') :ChildOf('bar') :Args { }
 
 #
 #   three chain with concurrent endpoints
@@ -49,7 +56,7 @@ sub higher_root :PathPart('bar') :ChildOf('/action/childof/foo/higher_root') :Ar
 #   Controller -> subcontroller -> controller
 #
 sub pcp1 :PathPart('childof/pcp1')  :ChildOf('/')                        :Captures(1) { }
-sub pcp3 :PathPart                  :ChildOf('/action/childof/foo/pcp2') :Args(1)     { }
+sub pcp3 :ChildOf('/action/childof/foo/pcp2') :Args(1)     { }
 
 #
 #   Dispatch on capture number
@@ -78,6 +85,18 @@ sub priority_b2_end :PathPart('end') :ChildOf('priority_b2') :Args(1) { }
 #
 sub opt_args :PathPart('childof/opt_args') :ChildOf('/') { }
 
+#
+#   Optional PathPart test -> /childof/optpp/*/opt_pathpart/*
+#
+sub opt_pp_start :ChildOf('/') :PathPart('childof/optpp') :Captures(1) { }
+sub opt_pathpart :ChildOf('opt_pp_start') :Args(1) { }
+
+#
+#   Optional Args *and* PathPart -> /childof/optall/*/oa/...
+#
+sub opt_all_start :ChildOf('/') :PathPart('childof/optall') :Captures(1) { }
+sub oa :ChildOf('opt_all_start') { }
+
 sub end :Private {
   my ($self, $c) = @_;
   my $out = join('; ', map { join(', ', @$_) }