Fixed :Path() empty brackets attribute not registering action.
[catagits/Catalyst-Runtime.git] / t / utf_incoming.t
index 6c0205d..5f12ecb 100644 (file)
@@ -33,7 +33,7 @@ use Scalar::Util ();
   sub uri_for :Path('uri_for') {
     my ($self, $c) = @_;
     $c->response->content_type('text/html');
-    $c->response->body("${\$c->uri_for($c->controller('Root')->action_for('argend'), ['♥'], '♥', {'♥'=>'♥♥'})}");
+    $c->response->body("${\$c->uri_for($c->controller('Root')->action_for('argend'), ['♥'], '♥#X♥X', {'♥'=>'♥♥'})}");
   }
 
   sub heart_with_arg :Path('a♥') Args(1)  {
@@ -113,14 +113,15 @@ use Scalar::Util ();
 
   sub write_then_body :Local {
     my ($self, $c) = @_;
-    $c->clear_encoding;
-    $c->res->content_type('text/plain');
+
+    $c->res->content_type('text/html');
     $c->res->write("<p>This is early_write action ♥</p>");
     $c->res->body("<p>This is body_write action ♥</p>");
   }
 
   sub file_upload :POST  Consumes(Multipart) Local {
     my ($self, $c) = @_;
+
     Test::More::is $c->req->body_parameters->{'♥'}, '♥♥';
     Test::More::ok my $upload = $c->req->uploads->{file};
     Test::More::is $upload->charset, 'UTF-8';
@@ -317,12 +318,12 @@ use Catalyst::Test 'MyApp';
 
 {
   my ($res, $c) = ctx_request "/root/uri_for";
-  my $url = $c->uri_for($c->controller('Root')->action_for('argend'), ['♥'], '♥', {'♥'=>'♥♥'});
+  my $url = $c->uri_for($c->controller('Root')->action_for('argend'), ['♥'], '♥#X♥X', {'♥'=>'♥♥'});
 
   is $res->code, 200, 'OK';
   is decode_utf8($res->content), "$url", 'correct body'; #should do nothing
   is $res->content, "$url", 'correct body';
-  is $res->content_length, 90, 'correct length';
+  is $res->content_length, 104, 'correct length';
   is $res->content_charset, 'UTF-8';
 
   {
@@ -481,17 +482,10 @@ SKIP: {
 
   is $c->req->body_parameters->{'arg0'}, 'helloworld', 'got helloworld value';
   is $c->req->body_parameters->{'♥'}, '♥♥';
-
-  ok Scalar::Util::blessed($c->req->body_parameters->{'arg1'});
-  ok Scalar::Util::blessed($c->req->body_parameters->{'arg2'}[0]);
-  ok Scalar::Util::blessed($c->req->body_parameters->{'arg2'}[1]);
-  ok Scalar::Util::blessed($c->req->body_parameters->{'♥♥♥'});
-
-  # Since the form post is COMPLEX you are expected to decode it yourself.
-  is Encode::decode('UTF-8', $c->req->body_parameters->{'arg1'}->raw_data), $utf8, 'decoded utf8 param';
-  is Encode::decode('SHIFT_JIS', $c->req->body_parameters->{'arg2'}[0]->raw_data), $shiftjs, 'decoded shiftjis param';
-  is Encode::decode('SHIFT_JIS', $c->req->body_parameters->{'arg2'}[1]->raw_data), $shiftjs, 'decoded shiftjis param';
-  is Encode::decode('SHIFT_JIS', $c->req->body_parameters->{'♥♥♥'}->raw_data), $shiftjs, 'decoded shiftjis param';
+  is $c->req->body_parameters->{'arg1'}, $utf8, 'decoded utf8 param';
+  is $c->req->body_parameters->{'arg2'}[0], $shiftjs, 'decoded shiftjs param';
+  is $c->req->body_parameters->{'arg2'}[1], $shiftjs, 'decoded shiftjs param';
+  is $c->req->body_parameters->{'♥♥♥'}, $shiftjs, 'decoded shiftjs param';
 
 }