Skip to content

Commit

Permalink
add test for binmode
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed May 9, 2010
1 parent 380a3b9 commit e041152
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/CGI/Emulate/PSGI.pm
Expand Up @@ -41,7 +41,6 @@ sub emulate_environment {
no warnings;
my $environment = {
GATEWAY_INTERFACE => 'CGI/1.1',
# not in RFC 3875
HTTPS => ( ( $env->{'psgi.url_scheme'} eq 'https' ) ? 'ON' : 'OFF' ),
SERVER_SOFTWARE => "CGI-Emulate-PSGI",
REMOTE_ADDR => '127.0.0.1',
Expand Down
20 changes: 20 additions & 0 deletions t/04_utf8.t
@@ -0,0 +1,20 @@
use strict;
use warnings;
use CGI;
use CGI::Emulate::PSGI;
use Test::More;

my $app = CGI::Emulate::PSGI->handler(
sub {
binmode STDOUT, ":utf8";
print "Content-Type: text/html\r\n\r\n";
print chr(4242);
},
);

my $res = $app->({ REQUEST_METHOD => 'GET', 'psgi.input' => \*STDIN, 'psgi.errors' => \*STDERR });
is $res->[0], 200;
is_deeply $res->[2], [ "\xe1\x82\x92" ];

done_testing;

0 comments on commit e041152

Please sign in to comment.