From: Graham Knop Date: Fri, 19 Jun 2020 21:36:29 +0000 (+0200) Subject: remove test using Params::Nested X-Git-Tag: v5.90_127~10^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=d70816e6a3b865ea3a3f2aa33bd166779df86072 remove test using Params::Nested This test was brought in via the encoding plugin. We don't need to test the behavior of this external plugin. --- diff --git a/Makefile.PL b/Makefile.PL index cfe61ef..d5b14fa 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -93,7 +93,6 @@ my %META = ( 'Test::Pod::Coverage' => 0, 'Test::Spelling' => 0, 'Pod::Coverage::TrustPod' => 0, - 'Catalyst::Plugin::Params::Nested' => 0, 'Compress::Zlib' => 0, 'Catalyst::Action::REST' => 0, 'Type::Tiny' => 0, diff --git a/t/lib/TestApp2.pm b/t/lib/TestApp2.pm deleted file mode 100644 index 53b483f..0000000 --- a/t/lib/TestApp2.pm +++ /dev/null @@ -1,19 +0,0 @@ -package TestApp2; -use strict; -use warnings; -use base qw/Catalyst/; -use Catalyst qw/Params::Nested/; - -__PACKAGE__->config( - 'name' => 'TestApp2', - encoding => 'UTF-8', -); - -__PACKAGE__->setup; - -sub handle_unicode_encoding_exception { - my ( $self, $param_value, $error_msg ) = @_; - return $param_value; -} - -1; diff --git a/t/lib/TestApp2/Controller/Root.pm b/t/lib/TestApp2/Controller/Root.pm deleted file mode 100644 index e40ee8c..0000000 --- a/t/lib/TestApp2/Controller/Root.pm +++ /dev/null @@ -1,16 +0,0 @@ -package TestApp2::Controller::Root; -use strict; -use warnings; -use utf8; - -__PACKAGE__->config(namespace => q{}); - -use base 'Catalyst::Controller'; - -# your actions replace this one -sub main :Path('') { - $_[1]->res->body('

It works

'); - $_[1]->res->content_type('text/html'); -} - -1; diff --git a/xt/author/unicode_plugin_nested_params.t b/xt/author/unicode_plugin_nested_params.t deleted file mode 100644 index e2680d1..0000000 --- a/xt/author/unicode_plugin_nested_params.t +++ /dev/null @@ -1,69 +0,0 @@ -use strict; -use warnings; -use Test::More; -use utf8; - -# setup library path -use FindBin qw($Bin); -use lib "$Bin/../../t/lib"; - -BEGIN { eval { require Catalyst::Plugin::Params::Nested; 1; } || - plan skip_all => 'Need Catalyst::Plugin::Params::Nested' } - -use Catalyst::Test 'TestApp2'; -use Encode; -use HTTP::Request::Common; -use URI::Escape qw/uri_escape_utf8/; -use HTTP::Status 'is_server_error'; - -my $encode_str = "\x{e3}\x{81}\x{82}"; # e38182 is japanese 'あ' -my $decode_str = Encode::decode('utf-8' => $encode_str); -my $escape_str = uri_escape_utf8($decode_str); - -BEGIN { - eval 'require Catalyst::Plugin::Params::Nested'; - plan skip_all => 'Catalyst::Plugin::Params::Nested is required' if $@; -} - -{ - my ($res, $c) = ctx_request("/?foo.1=bar&foo.2=$escape_str"); - is( $c->res->output, '

It works

', 'Content displayed' ); - - my $got = $c->request->parameters; - my $expected = { - 'foo.1' => 'bar', - 'foo.2' => $decode_str, - 'foo' => [undef, 'bar', $decode_str], - }; - - is( $got->{foo}->[0], undef, '{foo}->[0] is undef' ); - is( $got->{foo}->[1], 'bar', '{foo}->[1] is bar' ); - ok( utf8::is_utf8( $got->{'foo.2'} ), '{foo.2} is utf8' ); - ok( utf8::is_utf8( $got->{foo}->[2] ), '{foo}->[2] is utf8' ); - is_deeply($got, $expected, 'nested params' ); -} - -{ - my ($res, $c) = ctx_request("/?foo.1=bar&foo.2=$escape_str&bar.baz=$escape_str&baz.bar.foo=$escape_str&&arr.0.1=$escape_str"); - - my $got = $c->request->parameters; - my $expected = { - 'foo.1' => 'bar', - 'foo.2' => $decode_str, - 'bar.baz' => $decode_str, - 'baz.bar.foo' => $decode_str, - 'arr.0.1' => $decode_str, - 'arr' => [ [undef, $decode_str] ], - 'foo' => [undef, 'bar', $decode_str], - 'bar' => { baz => $decode_str }, - 'baz' => { bar => { foo => $decode_str } }, - }; - - is( ref $got->{arr}->[0], 'ARRAY', '{arr}->[0] is ARRAY' ); - ok( utf8::is_utf8( $got->{arr}->[0]->[1] ), '{arr}->[0]->[1] is utf8' ); - ok( utf8::is_utf8( $got->{bar}{baz} ), '{bar}{baz} is utf8' ); - ok( utf8::is_utf8( $got->{baz}{bar}{foo} ), '{baz}{bar}{foo} is utf8' ); - is_deeply($got, $expected, 'nested params' ); -} - -done_testing();