[Catalyst-commits] r9594 - in
Catalyst-Runtime/5.80/branches/uri_for_action: lib t/aggregate
hdp at dev.catalyst.perl.org
hdp at dev.catalyst.perl.org
Sat Mar 28 05:01:57 GMT 2009
Author: hdp
Date: 2009-03-28 05:01:57 +0000 (Sat, 28 Mar 2009)
New Revision: 9594
Modified:
Catalyst-Runtime/5.80/branches/uri_for_action/lib/Catalyst.pm
Catalyst-Runtime/5.80/branches/uri_for_action/t/aggregate/unit_core_uri_for_action.t
Log:
include test for failure mode
Modified: Catalyst-Runtime/5.80/branches/uri_for_action/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/uri_for_action/lib/Catalyst.pm 2009-03-28 04:49:21 UTC (rev 9593)
+++ Catalyst-Runtime/5.80/branches/uri_for_action/lib/Catalyst.pm 2009-03-28 05:01:57 UTC (rev 9594)
@@ -1250,6 +1250,9 @@
my $action = blessed($path)
? $path
: $c->dispatcher->get_action_by_path($path);
+ unless (defined $action) {
+ croak "Can't find action for path '$path'";
+ }
return $c->uri_for( $action, @args );
}
Modified: Catalyst-Runtime/5.80/branches/uri_for_action/t/aggregate/unit_core_uri_for_action.t
===================================================================
--- Catalyst-Runtime/5.80/branches/uri_for_action/t/aggregate/unit_core_uri_for_action.t 2009-03-28 04:49:21 UTC (rev 9593)
+++ Catalyst-Runtime/5.80/branches/uri_for_action/t/aggregate/unit_core_uri_for_action.t 2009-03-28 05:01:57 UTC (rev 9594)
@@ -8,7 +8,7 @@
use Test::More;
-plan tests => 28;
+plan tests => 29;
use_ok('TestApp');
@@ -164,6 +164,10 @@
is( $context->uri_for_action( $complex_chained, [23], (13), {q => 3} ),
'http://127.0.0.1/foo/chained/empty/23/13?q=3',
'uri_for_action returns correct uri for chain with many empty path parts' );
+
+ eval { $context->uri_for_action( '/does/not/exist' ) };
+ like $@, qr{^Can't find action for path '/does/not/exist'},
+ 'uri_for_action croaks on nonexistent path';
+
}
-
More information about the Catalyst-commits
mailing list