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