unmark +x and remove shebangs
[catagits/Catalyst-Runtime.git] / t / unicode_plugin_no_encoding.t
CommitLineData
4fb27043 1use strict;
2use warnings;
3use Test::More;
4use utf8;
5
6# setup library path
7use FindBin qw($Bin);
8use lib "$Bin/lib";
9
10use Catalyst::Test 'TestAppWithoutUnicode';
11use Encode;
12use HTTP::Request::Common;
13use URI::Escape qw/uri_escape_utf8/;
14use HTTP::Status 'is_server_error';
1a87d45c 15use Data::Dumper;
4fb27043 16
17my $encode_str = "\x{e3}\x{81}\x{82}"; # e38182 is japanese 'あ'
18my $decode_str = Encode::decode('utf-8' => $encode_str);
19my $escape_str = uri_escape_utf8($decode_str);
20
b4982899 21# JNAP - I am removing this test case because I think its not correct. I think
22# we do not check the server encoding to determine if the parts of a request URL
23# both paths and query should be decoded. I think its always safe to assume utf8
24# encoded urlencoded bits. That is my reading of the spec. Please correct me if
25# I am wrong
26#check_parameter(GET "/?myparam=$escape_str");
a6a3355f 27check_parameter(POST '/',
28 Content_Type => 'form-data',
29 Content => [
30 'myparam' => [
31 "$Bin/unicode_plugin_no_encoding.t",
32 "$Bin/unicode_plugin_request_decode.t",
33 ]
34 ],
35);
4fb27043 36
37sub check_parameter {
38 my ( undef, $c ) = ctx_request(shift);
4fb27043 39
40 my $myparam = $c->req->param('myparam');
a6a3355f 41 unless ( $c->request->method eq 'POST' ) {
42 is $c->res->output => $encode_str;
43 is $myparam => $encode_str;
44 }
4fb27043 45
1a87d45c 46 is scalar(@TestLogger::ELOGS), 0
4fb27043 47 or diag Dumper(\@TestLogger::ELOGS);
4fb27043 48}
49
50done_testing;