From: Rafael Kitover Date: Tue, 26 May 2009 15:02:53 +0000 (+0000) Subject: add tests which prove the current behavior of not decoding chained args but decoding... X-Git-Tag: 5.80005~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=2c527b9130ee042eaa8e5996f565c75764d18117;hp=4e392da63f7488684620b312d3dec54af9a94db6 add tests which prove the current behavior of not decoding chained args but decoding local args --- diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index 74db1f2..70b539d 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 143*$iters; +use Test::More tests => 145*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -1004,4 +1004,12 @@ sub run_tests { $expected, 'Executed actions' ); } } + + { + ok( my $content = + get('http://localhost/chained/return_arg/foo%2Fbar%3B'), + 'request with URI-encoded arg' ); + # this is the CURRENT behavior + like( $content, qr{foo%2Fbar%3B\z}, 'args NOT decoded' ); + } } diff --git a/t/aggregate/live_component_controller_action_local.t b/t/aggregate/live_component_controller_action_local.t index ae98831..24fc2e4 100644 --- a/t/aggregate/live_component_controller_action_local.t +++ b/t/aggregate/live_component_controller_action_local.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 32*$iters; +use Test::More tests => 34*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -135,4 +135,11 @@ sub run_tests { "Parameters don't split on %2F" ); } + + { + ok( my $content = get('http://locahost/action/local/five/foo%2Fbar%3B'), + 'request with URI-encoded arg'); + # this is the CURRENT behavior + like( $content, qr{'foo/bar;'}, 'args for Local actions URI-decoded' ); + } } diff --git a/t/lib/TestApp/Controller/Action/Chained.pm b/t/lib/TestApp/Controller/Action/Chained.pm index 0efdcca..c3c85fe 100644 --- a/t/lib/TestApp/Controller/Action/Chained.pm +++ b/t/lib/TestApp/Controller/Action/Chained.pm @@ -195,6 +195,8 @@ sub view : Chained('/') PathPart('chained') CaptureArgs(1) {} sub star_search : Chained('view') PathPart('search') Args(0) { } sub doc_star : Chained('/') PathPart('chained/doc') Args(1) {} +sub return_arg : Chained('/') PathPart('chained/return_arg') Args(1) {} + sub end :Private { my ($self, $c) = @_; return if $c->stash->{no_end}; diff --git a/t/lib/TestApp/Controller/Action/Local.pm b/t/lib/TestApp/Controller/Action/Local.pm index 9d30cf2..d1672a0 100644 --- a/t/lib/TestApp/Controller/Action/Local.pm +++ b/t/lib/TestApp/Controller/Action/Local.pm @@ -23,4 +23,9 @@ sub four : Action Path('four/five/six') { $c->forward('TestApp::View::Dump::Request'); } +sub five : Action Local Args(1) { + my ( $self, $c ) = @_; + $c->forward('TestApp::View::Dump::Request'); +} + 1;