Don't run the moose controller test if Moose isn't available
[catagits/Catalyst-Runtime.git] / t / unit_core_uri_for_multibytechar.t
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 tests => 5;
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),
16     uri  => URI->new("$base/"),
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(
27     name => '村瀬大輔',
28 );
29
30 # multibyte with utf8 bytes
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');
33
34 # multibyte with utf8 string
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');