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