Commit | Line | Data |
0ce485e9 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use FindBin; |
42da66a9 |
5 | use lib "$FindBin::Bin/../lib"; |
0ce485e9 |
6 | |
01d6806b |
7 | use Test::More tests => 5; |
0ce485e9 |
8 | |
9 | use_ok('TestApp'); |
10 | |
11 | my $base = 'http://127.0.0.1'; |
12 | |
13 | my $request = Catalyst::Request->new({ |
14 | base => URI->new($base), |
7066a4d5 |
15 | uri => URI->new("$base/"), |
0ce485e9 |
16 | }); |
17 | |
18 | my $context = TestApp->new({ |
19 | request => $request, |
20 | }); |
21 | |
22 | |
23 | my $uri_with_multibyte = URI->new($base); |
24 | $uri_with_multibyte->path('/'); |
25 | $uri_with_multibyte->query_form( |
5afbe5de |
26 | name => '村瀬大輔', |
0ce485e9 |
27 | ); |
28 | |
0ce485e9 |
29 | # multibyte with utf8 bytes |
7066a4d5 |
30 | is($context->uri_for('/', { name => '村瀬大輔' }), $uri_with_multibyte, 'uri_for with utf8 bytes query'); |
31 | is($context->req->uri_with({ name => '村瀬大輔' }), $uri_with_multibyte, 'uri_with with utf8 bytes query'); |
0ce485e9 |
32 | |
33 | # multibyte with utf8 string |
7066a4d5 |
34 | is($context->uri_for('/', { name => "\x{6751}\x{702c}\x{5927}\x{8f14}" }), $uri_with_multibyte, 'uri_for with utf8 string query'); |
35 | is($context->req->uri_with({ name => "\x{6751}\x{702c}\x{5927}\x{8f14}" }), $uri_with_multibyte, 'uri_with with utf8 string query'); |