Home | History | Annotate | Line # | Download | only in tests
      1  1.1  christos #! /bin/sh
      2  1.1  christos 
      3  1.1  christos # Test that on glibc systems, gettext() works right even with intermediate
      4  1.1  christos # setlocale() calls.
      5  1.1  christos 
      6  1.1  christos tmpfiles=""
      7  1.1  christos trap 'rm -fr $tmpfiles' 1 2 3 15
      8  1.1  christos 
      9  1.1  christos # This test works only on glibc systems.
     10  1.1  christos grep '@GLIBC2@.*yes' ../config.status >/dev/null || {
     11  1.1  christos   echo "Skipping test: not a glibc system"
     12  1.1  christos   exit 77
     13  1.1  christos }
     14  1.1  christos 
     15  1.1  christos # This test works only on systems that have a de_DE and fr_FR locale installed.
     16  1.1  christos LC_ALL=de_DE ./testlocale || {
     17  1.1  christos   if test -f /usr/bin/localedef; then
     18  1.1  christos     echo "Skipping test: locale de_DE not installed"
     19  1.1  christos   else
     20  1.1  christos     echo "Skipping test: locale de_DE not supported"
     21  1.1  christos   fi
     22  1.1  christos   exit 77
     23  1.1  christos }
     24  1.1  christos LC_ALL=fr_FR ./testlocale || {
     25  1.1  christos   if test -f /usr/bin/localedef; then
     26  1.1  christos     echo "Skipping test: locale fr_FR not installed"
     27  1.1  christos   else
     28  1.1  christos     echo "Skipping test: locale fr_FR not supported"
     29  1.1  christos   fi
     30  1.1  christos   exit 77
     31  1.1  christos }
     32  1.1  christos 
     33  1.1  christos tmpfiles="$tmpfiles de_DE fr_FR"
     34  1.1  christos test -d de_DE || mkdir de_DE
     35  1.1  christos test -d de_DE/LC_MESSAGES || mkdir de_DE/LC_MESSAGES
     36  1.1  christos test -d fr_FR || mkdir fr_FR
     37  1.1  christos test -d fr_FR/LC_MESSAGES || mkdir fr_FR/LC_MESSAGES
     38  1.1  christos 
     39  1.1  christos : ${MSGFMT=msgfmt}
     40  1.1  christos ${MSGFMT} -o de_DE/LC_MESSAGES/tstlang.mo ${top_srcdir}/tests/gettext-3-1.po
     41  1.1  christos ${MSGFMT} -o fr_FR/LC_MESSAGES/tstlang.mo ${top_srcdir}/tests/gettext-3-2.po
     42  1.1  christos 
     43  1.1  christos tmpfiles="$tmpfiles gt-3.ok"
     44  1.1  christos cat <<EOF > gt-3.ok
     45  1.1  christos String1 - Lang1: 1st string
     46  1.1  christos String2 - Lang1: 2nd string
     47  1.1  christos String1 - Lang2: 1st string
     48  1.1  christos String2 - Lang2: 2nd string
     49  1.1  christos String1 - First string for testing.
     50  1.1  christos String2 - Another string for testing.
     51  1.1  christos EOF
     52  1.1  christos 
     53  1.1  christos tmpfiles="$tmpfiles gt-3.out"
     54  1.1  christos ./gettext-3-prg > gt-3.out || exit 1
     55  1.1  christos 
     56  1.1  christos : ${DIFF=diff}
     57  1.1  christos ${DIFF} gt-3.ok gt-3.out || exit 1
     58  1.1  christos 
     59  1.1  christos rm -fr $tmpfiles
     60  1.1  christos 
     61  1.1  christos exit 0
     62