Permalink
Browse files

Added a test for binmode :utf8 in CGI scripts. Depends CGI::Emulate::…

…PSGI 0.07 that fixes it. Fixes gh-110
  • Loading branch information...
1 parent a3cb4dc commit 276df219e1dc16cf9a6a400d852426c6da9ddbfd @miyagawa miyagawa committed Apr 27, 2010
Showing with 12 additions and 1 deletion.
  1. +6 −0 t/Plack-Middleware/cgi-bin/utf8.cgi
  2. +6 −1 t/Plack-Middleware/cgibin.t
View
6 t/Plack-Middleware/cgi-bin/utf8.cgi
@@ -0,0 +1,6 @@
+#!perl
+
+use CGI;
+binmode STDOUT, ":utf8";
+print CGI::header("text/html;charset=utf-8"), chr(4343), "\n";
+
View
7 t/Plack-Middleware/cgibin.t
@@ -1,6 +1,6 @@
use strict;
use Test::More;
-use Test::Requires { 'CGI::Emulate::PSGI' => 0, 'CGI::Compile' => 0.03 };
+use Test::Requires { 'CGI::Emulate::PSGI' => 0.07, 'CGI::Compile' => 0.03 };
use Plack::Test;
use HTTP::Request::Common;
use Plack::App::CGIBin;
@@ -36,6 +36,11 @@ test_psgi app => $app, client => sub {
$res = $cb->(GET "http://localhost/hello4.cgi");
is $res->code, 404;
+
+ $res = $cb->(GET "http://localhost/utf8.cgi");
+ is $res->code, 200;
+ is length $res->content, 4;
+ is $res->content, "\xe1\x83\xb7\n";
};
done_testing;

0 comments on commit 276df21

Please sign in to comment.