root/lang/perl/FormValidator-LazyWay/trunk/t/setting-unicode.t @ 16818

Revision 16818, 1.3 kB (checked in by vkgtaro, 5 years ago)

文字化けてた

Line 
1use Test::Base;
2use FormValidator::LazyWay;
3use FindBin;
4use File::Spec;
5use CGI;
6use YAML::Syck;
7use lib File::Spec->catfile( $FindBin::Bin, 'lib' );
8use Data::Dumper;
9use Encode;
10use utf8;
11
12plan tests => 1 * blocks;
13
14run {
15    my $block = shift;
16
17    my $cgi = new CGI( $block->param ) ;
18
19    my $config = Load($block->yaml);
20    my $fv = FormValidator::LazyWay->new( config => $config, unicode => 1 );
21
22    # 期待される結果は flagged UTF-8
23    my $expected;
24    {
25        local $Data::Dumper::Terse = 1;
26        $expected = decode('utf8', Dumper($block->expected) );
27    }
28
29    $expected = eval $expected;
30
31    is_deeply($fv->config, $expected );
32}
33
34__END__
35=== sccess1
36--- yaml
37rules:
38  - String
39setting:
40  strict:
41    name:
42      rule:
43        - String#string
44    kana:
45      rule:
46        - String#string
47lang: ja
48labels:
49  ja:
50    name: 名前
51    kana: カナ
52--- expected eval
53{   'messages' => { 'ja' => { 'rule' => {} } },
54    'lang'     => 'ja',
55    'setting'  => {
56        'strict' => {
57            'name' => { 'rule' => [ 'String#string' ] },
58            'kana' => { 'rule' => [ 'String#string' ] }
59        }
60    },
61    'labels' => {
62        'ja' => {
63            'name' => '名前',
64            'kana' => 'カナ'
65        }
66    },
67    'rules' => [ 'String' ]
68}
69
Note: See TracBrowser for help on using the browser.