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