Line 0
Link Here
|
0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
use Test::More; |
3 |
|
4 |
use YAML::Syck; |
5 |
use Template; |
6 |
use utf8; |
7 |
|
8 |
$YAML::Syck::ImplicitTyping = 1; |
9 |
$YAML::Syck::ImplicitUnicode = 1; |
10 |
|
11 |
my $template = Template->new( ENCODING => 'UTF-8' ); |
12 |
|
13 |
my $vars; |
14 |
my $output; |
15 |
$template->process( 't/db_dependent/data/syspref.pref', $vars, \$output ); |
16 |
|
17 |
use Data::Printer colored => 1; warn p $output; |
18 |
|
19 |
my $yaml = YAML::Syck::Load( $output ); |
20 |
my $syspref_1 = $yaml->{Test}->{Testing}->[0]; |
21 |
my $syspref_2 = $yaml->{Test}->{Testing}->[1]; |
22 |
my $syspref_3 = $yaml->{Test}->{Testing}->[2]; |
23 |
my $syspref_4 = $yaml->{Test}->{Testing}->[3]; |
24 |
is_deeply( |
25 |
$syspref_1, |
26 |
[ |
27 |
"Do it", |
28 |
{ |
29 |
choices => { |
30 |
1 => "certainly", |
31 |
'' => "I don't think so" |
32 |
}, |
33 |
pref => "syspref_1" |
34 |
} |
35 |
] |
36 |
); |
37 |
is_deeply( |
38 |
$syspref_2, |
39 |
[ |
40 |
{ |
41 |
choices => { |
42 |
0 => "really don't do", |
43 |
'' => "Do", |
44 |
dont => "Don't do" |
45 |
}, |
46 |
pref => "syspref_2" |
47 |
}, |
48 |
"it." |
49 |
] |
50 |
); |
51 |
is_deeply( |
52 |
$syspref_3, |
53 |
[ |
54 |
"We love unicode", |
55 |
{ |
56 |
choices => { |
57 |
'' => "Not really", |
58 |
'★' => "❤️" |
59 |
}, |
60 |
pref => "syspref_3" |
61 |
} |
62 |
], |
63 |
); |
64 |
is_deeply( |
65 |
$syspref_4, |
66 |
[ |
67 |
"List of fields", |
68 |
{ |
69 |
choices => { |
70 |
16 => 16, |
71 |
"020" => "020", |
72 |
123 => 123 |
73 |
}, |
74 |
pref => "syspref_4" |
75 |
} |
76 |
] |
77 |
); |
78 |
done_testing; |