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

(-)a/xt/sample_notices.t (-5 / +14 lines)
Lines 22-28 use Test::More qw(no_plan); Link Here
22
22
23
23
24
my $root_dir = 'installer/data/mysql';
24
my $root_dir = 'installer/data/mysql';
25
my $base_notices_file = "en/mandatory/sample_notices.sql";
25
my $base_notices_file = "en/mandatory/sample_notices.yml";
26
my @trans_notices_files = qw(
26
my @trans_notices_files = qw(
27
    fr-FR/1-Obligatoire/sample_notices.sql
27
    fr-FR/1-Obligatoire/sample_notices.sql
28
    fr-CA/obligatoire/sample_notices.sql
28
    fr-CA/obligatoire/sample_notices.sql
Lines 38-44 my @trans_notices_files = qw( Link Here
38
ok(
38
ok(
39
    open( my $ref_fh, "<", "$root_dir/$base_notices_file" ),
39
    open( my $ref_fh, "<", "$root_dir/$base_notices_file" ),
40
    "Open reference sample notices file $root_dir/$base_notices_file" );
40
    "Open reference sample notices file $root_dir/$base_notices_file" );
41
my $ref_notice = get_notices_from_file( $ref_fh );
41
my $ref_notice = get_notices_from_yml_file( $ref_fh );
42
my @ref_notices = sort { lc $a cmp lc $b } keys %$ref_notice;
42
my @ref_notices = sort { lc $a cmp lc $b } keys %$ref_notice;
43
cmp_ok(
43
cmp_ok(
44
    $#ref_notices, '>=', 0,
44
    $#ref_notices, '>=', 0,
Lines 53-59 foreach my $file_name ( @trans_notices_files ) { Link Here
53
# Get sample notices from SQL file populating letters table with INSERT
53
# Get sample notices from SQL file populating letters table with INSERT
54
# statement.
54
# statement.
55
#
55
#
56
sub get_notices_from_file {
56
sub get_notices_from_sql_file {
57
    my $fh = shift;
57
    my $fh = shift;
58
    my %notice;
58
    my %notice;
59
    while ( <$fh> ) {
59
    while ( <$fh> ) {
Lines 62-67 sub get_notices_from_file { Link Here
62
    }
62
    }
63
    return \%notice;
63
    return \%notice;
64
}
64
}
65
sub get_notices_from_yml_file {
66
    my $fh = shift;
67
    my %notice;
68
    while ( <$fh> ) {
69
        next unless /^\s+code:\s([\_A-Z_]*)$/;
70
        $notice{$1} = 1;
71
    }
72
    return \%notice;
73
}
74
65
75
66
76
67
sub compare_notices {
77
sub compare_notices {
Lines 69-75 sub compare_notices { Link Here
69
    ok(
79
    ok(
70
       open( my $trans_fh,"<", "$root_dir/$trans_file" ),
80
       open( my $trans_fh,"<", "$root_dir/$trans_file" ),
71
       "Open translated sample notices file $root_dir/$trans_file" );
81
       "Open translated sample notices file $root_dir/$trans_file" );
72
    my $trans_notice = get_notices_from_file( $trans_fh );
82
    my $trans_notice = get_notices_from_sql_file( $trans_fh );
73
    use YAML;
83
    use YAML;
74
    my @trans_notices = sort { lc $a cmp lc $b } keys %$trans_notice;
84
    my @trans_notices = sort { lc $a cmp lc $b } keys %$trans_notice;
75
    cmp_ok(
85
    cmp_ok(
76
- 

Return to bug 24583