From: Dagfinn Ilmari Mannsåker Date: Wed, 5 Dec 2012 12:07:02 +0000 (+0000) Subject: Make URI query param tests simpler and more robust X-Git-Tag: 5.90020~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=d527814de606d136a35990e042cb1e23e54a73dd Make URI query param tests simpler and more robust --- diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index b4907f7..d6fcfed 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -11,6 +11,8 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More; +use URI; +use URI::QueryParam; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -1115,9 +1117,7 @@ sub run_tests { # where the app is based (live tests etc) is $got->path, $exp->path, "uri $path can round trip through uri_for (path)" or diag("Expected $path, got $content"); - my %got_q = map { split /=/ } split /\&/, ($got->query||''); - my %exp_q = map { split /=/ } split /\&/, ($exp->query||''); - is_deeply \%got_q, \%exp_q, "uri $path can round trip through uri_for (query)" + is_deeply $got->query_form_hash, $exp->query_form_hash, "uri $path can round trip through uri_for (query)" or diag("Expected $path, got $content"); } diff --git a/t/aggregate/unit_core_uri_with.t b/t/aggregate/unit_core_uri_with.t index 0af788f..1e13a9b 100644 --- a/t/aggregate/unit_core_uri_with.t +++ b/t/aggregate/unit_core_uri_with.t @@ -3,6 +3,7 @@ use warnings; use Test::More; use URI; +use URI::QueryParam; use Catalyst::Log; use_ok('Catalyst::Request'); @@ -14,9 +15,7 @@ sub cmp_uri { foreach my $thing (qw/ scheme host path /) { is $exp->$thing, $got->$thing, "$comment: $thing"; } - my %got_q = map { split /=/ } split /\&/, ($got->query||''); - my %exp_q = map { split /=/ } split /\&/, ($exp->query||''); - is_deeply \%got_q, \%exp_q, "$comment: query"; + is_deeply $got->query_form_hash, $exp->query_form_hash, "$comment: query"; } my $request = Catalyst::Request->new( {