line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1862
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1462
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
sub gen { |
4
|
3
|
|
|
3
|
|
15
|
my ($domain) = @_; |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
|
|
4
|
my $messages; |
7
|
|
|
|
|
|
|
my $language; |
8
|
3
|
50
|
|
|
|
321576
|
unless (open(LOCALE, "locale|")) { |
9
|
0
|
|
|
|
|
0
|
doskip(); |
10
|
|
|
|
|
|
|
} |
11
|
3
|
|
|
|
|
36323
|
while () { |
12
|
45
|
100
|
|
|
|
595
|
if (/^LC_MESSAGES=\"(.*)\"$/) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
13
|
3
|
|
|
|
|
32
|
$messages = $1; |
14
|
|
|
|
|
|
|
} elsif (/^LC_MESSAGES=(.*)$/) { |
15
|
0
|
|
|
|
|
0
|
$messages = $1; |
16
|
|
|
|
|
|
|
} elsif (/^LANGUAGE=\"(.*)\"$/) { |
17
|
0
|
|
|
|
|
0
|
$language = $1; |
18
|
|
|
|
|
|
|
} elsif (/^LANGUAGE=(.*)$/) { |
19
|
3
|
|
|
|
|
74
|
$language = $1; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
3
|
|
|
|
|
165
|
close LOCALE; |
23
|
3
|
50
|
|
|
|
45
|
if ($? != 0) { |
24
|
0
|
|
|
|
|
0
|
doskip(); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
3
|
50
|
|
|
|
25
|
if (!defined($messages)) { |
28
|
0
|
|
|
|
|
0
|
skip("cannot run test without a locale set", 0); |
29
|
0
|
|
|
|
|
0
|
exit 0; |
30
|
|
|
|
|
|
|
} |
31
|
3
|
50
|
|
|
|
27
|
if ($messages eq 'C') { |
32
|
0
|
|
|
|
|
0
|
skip("cannot run test in the C locale", 0); |
33
|
0
|
|
|
|
|
0
|
exit 0; |
34
|
|
|
|
|
|
|
} |
35
|
3
|
50
|
|
|
|
23
|
if ($messages eq 'POSIX') { |
36
|
3
|
|
|
|
|
94
|
skip("cannot run test in the POSIX locale", 0); |
37
|
3
|
|
|
|
|
1447
|
exit 0; |
38
|
|
|
|
|
|
|
} |
39
|
0
|
0
|
0
|
|
|
|
if (defined($language) && $language) { |
40
|
|
|
|
|
|
|
# In GNU gettext, $LANGUAGE overrides |
41
|
|
|
|
|
|
|
# all the other environment variables, |
42
|
|
|
|
|
|
|
# for message translations only. |
43
|
|
|
|
|
|
|
# https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable |
44
|
|
|
|
|
|
|
# The library will look first for the first entry in |
45
|
|
|
|
|
|
|
# that list, so give it what it wants. |
46
|
0
|
|
|
|
|
|
$messages = (split(':', $language))[0]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
mkdir "test_data/" . $messages, 0755 unless (-d "test_data/" . $messages); |
50
|
0
|
0
|
|
|
|
|
mkdir "test_data/" . $messages . "/LC_MESSAGES", 0755 |
51
|
|
|
|
|
|
|
unless (-d "test_data/" . $messages . "/LC_MESSAGES"); |
52
|
0
|
0
|
|
|
|
|
unless (-r ("test_data/" . $messages . "/LC_MESSAGES/" . $domain . ".mo")) { |
53
|
0
|
|
|
|
|
|
system "msgfmt", "-o", "test_data/" . $messages . "/LC_MESSAGES/" . |
54
|
|
|
|
|
|
|
$domain . ".mo", |
55
|
|
|
|
|
|
|
"test_data/" . $domain . ".po"; |
56
|
0
|
0
|
|
|
|
|
if ($? != 0) { |
57
|
0
|
|
|
|
|
|
doskip(); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub doskip { |
63
|
0
|
|
|
0
|
|
|
skip("could not generate test data, skipping test", 0); |
64
|
0
|
|
|
|
|
|
exit 0; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |