File: utf8.t

package info (click to toggle)
libplack-middleware-debug-perl 0.18%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 599; javascript: 133; makefile: 8; sql: 5
file content (28 lines) | stat: -rw-r--r-- 666 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use warnings;
use strict;
use Encode;
use Plack::Test;
use Plack::Middleware::Debug;
use HTTP::Request::Common;
use Test::More;

my $app = sub {
    my $env = shift;
    $env->{'test.string'} = "\x{30c6}";
    return [
        200, [ 'Content-Type' => 'text/html' ],
        [ encode_utf8("<body><h1>\x{30c6}\x{30b9}\x{30c8}</h1></body>") ]
    ];
};

$app = Plack::Middleware::Debug->wrap($app);

test_psgi $app, sub {
    my $cb  = shift;
    my $res = $cb->(GET '/');
    is $res->code, 200, 'response status 200';
    like $res->content, qr!<h1>ใƒ†ใ‚นใƒˆ</h1>!;
    like $res->content, qr!<td>test.string</td>\s*<td><pre>&#x30c6;</pre></td>!s;
};

done_testing;