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