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 | |
8 | use Test::More; |
9 | |
7066a4d5 |
10 | plan tests => 5; |
0ce485e9 |
11 | |
12 | use_ok('TestApp'); |
13 | |
14 | my $base = 'http://127.0.0.1'; |
15 | |
16 | my $request = Catalyst::Request->new({ |
17 | base => URI->new($base), |
7066a4d5 |
18 | uri => URI->new("$base/"), |
0ce485e9 |
19 | }); |
20 | |
21 | my $context = TestApp->new({ |
22 | request => $request, |
23 | }); |
24 | |
25 | |
26 | my $uri_with_multibyte = URI->new($base); |
27 | $uri_with_multibyte->path('/'); |
28 | $uri_with_multibyte->query_form( |
29 | name => '村瀬大輔', |
30 | ); |
31 | |
32 | |
33 | # multibyte with utf8 bytes |
7066a4d5 |
34 | is($context->uri_for('/', { name => '村瀬大輔' }), $uri_with_multibyte, 'uri_for with utf8 bytes query'); |
35 | is($context->req->uri_with({ name => '村瀬大輔' }), $uri_with_multibyte, 'uri_with with utf8 bytes query'); |
0ce485e9 |
36 | |
37 | # multibyte with utf8 string |
7066a4d5 |
38 | is($context->uri_for('/', { name => "\x{6751}\x{702c}\x{5927}\x{8f14}" }), $uri_with_multibyte, 'uri_for with utf8 string query'); |
39 | is($context->req->uri_with({ name => "\x{6751}\x{702c}\x{5927}\x{8f14}" }), $uri_with_multibyte, 'uri_with with utf8 string query'); |