blob: 62e1de11d8772ea7fce9b7c67771e603fee0fc6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/bin/sh
#
# Some tests for java support
#
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles xg-j-1.java"
cat <<EOF > xg-j-1.java
class TestCase {
public TestCase() {
ResourceBundle b = ResourceBundle.getBundle("test");
GetTextBundle b2 = (GetTextBundle)b;
// standard usage
String test1 = b.getString("Test String 1");
// gettext usage
String test2 = b2.gettext("Test String 2");
/* C style comment */
String test3 = b.getString("Test String 3");
// java "multiline" string
String test4 = b.getString("Test " +
"String " +
"4");
// empty string
String test5 = b.getString("");
}
}
EOF
tmpfiles="$tmpfiles xg-j-1.tmp.po xg-j-1.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location -c -d xg-j-1.tmp xg-j-1.java
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
LC_ALL=C tr -d '\r' < xg-j-1.tmp.po > xg-j-1.po
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles xg-j-1.ok"
cat <<EOF > xg-j-1.ok
#. standard usage
msgid "Test String 1"
msgstr ""
#. gettext usage
msgid "Test String 2"
msgstr ""
#. C style comment
msgid "Test String 3"
msgstr ""
#. java "multiline" string
msgid "Test String 4"
msgstr ""
#. empty string
msgid ""
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} xg-j-1.ok xg-j-1.po
result=$?
rm -fr $tmpfiles
exit $result
|