File: encoding.t

package info (click to toggle)
libmojolicious-plugin-cgi-perl 0.36-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 208 kB
  • ctags: 17
  • sloc: perl: 300; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 715 bytes parent folder | download
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
29
30
31
32
use utf8;
use t::Helper;
use Mojo::UserAgent;
use Mojo::Util qw(decode spurt);

{
  use Mojolicious::Lite;
  use Mojo::Util 'decode';

  plugin CGI => {
    route => '/',
    run   => sub {
      diag "PATH_INFO=$ENV{PATH_INFO}";
      print "HTTP/1.1 200 OK\r\n";
      print "Content-Type: text/plain; charset=UTF-8\r\n";
      print "\r\n";
      print "p=$ENV{PATH_INFO}\n";
    },
  };
}

# Application is alive
my $t = Test::Mojo->new;
my @w;

$t->get_ok("/foo")->status_is(200)->content_is("p=/foo\n", 'ascii');
$t->get_ok("/föö")->status_is(200)->content_is("p=/föö\n", 'umlauts');
$t->get_ok("/fö’")->status_is(200)->content_is("p=/fö’\n", 'quote');

is "@w", "", "no warnings";

done_testing();