xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/msgunfmt-java-1 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#! /bin/sh
2
3# Test of --java option.
4
5# Note: This test fails when using gcj from GCC 3.1 and GCC 3.2, due to a bug
6# (libgcj/6576). It is fixed in GCC 3.3.
7
8tmpfiles=""
9trap 'rm -fr $tmpfiles' 1 2 3 15
10
11# Test whether we can compile and execute Java programs.
12test "${JAVA_CHOICE}" != no || {
13  echo "Skipping test: configured with --disable-java"
14  exit 77
15}
16test "${BUILDJAVA}" = yes || {
17  echo "Skipping test: Java compiler or jar not found"
18  exit 77
19}
20test "${TESTJAVA}" = yes || {
21  echo "Skipping test: Java engine not found"
22  exit 77
23}
24
25tmpfiles="$tmpfiles fr.po"
26cat <<\EOF > fr.po
27msgid ""
28msgstr ""
29"Content-Type: text/plain; charset=ISO-8859-1\n"
30"Plural-Forms: nplurals=2; plural=(n > 1);\n"
31
32msgid "'Your command, please?', asked the waiter."
33msgstr "�Votre commande, s'il vous plait�, dit le gar�on."
34
35# Les gateaux allemands sont les meilleurs du monde.
36#, java-format
37msgid "a piece of cake"
38msgid_plural "{0,number} pieces of cake"
39msgstr[0] "un morceau de gateau"
40msgstr[1] "{0,number} morceaux de gateau"
41
42# Reverse the arguments.
43#, java-format
44msgid "{0} is replaced by {1}."
45msgstr "{1} remplace {0}."
46EOF
47
48tmpfiles="$tmpfiles prog_fr.class"
49: ${MSGFMT=msgfmt}
50${MSGFMT} -j -d . -r prog -l fr fr.po || exit 1
51
52tmpfiles="$tmpfiles prog.out"
53: ${MSGUNFMT=msgunfmt}
54CLASSPATH=.${CLASSPATH:+:$CLASSPATH} \
55GETTEXTJEXEDIR=../src GETTEXTJAR=../src/gettext.jar \
56${MSGUNFMT} --java -d . -r prog -l fr -o prog.out || exit 1
57
58tmpfiles="$tmpfiles prog.sort"
59: ${MSGCAT=msgcat}
60${MSGCAT} -s -o prog.sort prog.out || exit 1
61
62tmpfiles="$tmpfiles prog.ok"
63cat <<\EOF > prog.ok
64msgid ""
65msgstr ""
66"Content-Type: text/plain; charset=UTF-8\n"
67"Plural-Forms: nplurals=2; plural=(n > 1);\n"
68
69msgid "'Your command, please?', asked the waiter."
70msgstr "«Votre commande, s'il vous plait», dit le garçon."
71
72msgid "a piece of cake"
73msgid_plural "{0,number} pieces of cake"
74msgstr[0] "un morceau de gateau"
75msgstr[1] "{0,number} morceaux de gateau"
76
77msgid "{0} is replaced by {1}."
78msgstr "{1} remplace {0}."
79EOF
80: ${DIFF=diff}
81${DIFF} prog.ok prog.sort || exit 1
82
83rm -fr $tmpfiles
84
85exit 0
86