View | Details | Raw Unified | Return to bug 22824
Collapse All | Expand All

(-)a/t/db_dependent/data/syspref.pref (+28 lines)
Line 0 Link Here
1
Test:
2
    Testing:
3
        -
4
            - Do it
5
            - pref: syspref_1
6
              choices:
7
                  on: certainly
8
                  off: "I don't think so"
9
        -
10
            - pref: syspref_2
11
              choices:
12
                  '': Do
13
                  dont: "Don't do"
14
                  0: "really don't do"
15
            - it.
16
        -
17
            - "We love unicode"
18
            - pref: syspref_3
19
              choices:
20
                  ★ : ❤️
21
                  no: "Not really"
22
        -
23
            - "List of fields"
24
            - pref: syspref_4
25
              choices:
26
                  020: 020
27
                  "020": "020"
28
                  "123": "123"
(-)a/t/db_dependent/yaml.t (-1 / +78 lines)
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;

Return to bug 22824