Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / lang-librep
index a03c5e1..4c7e3f2 100755 (executable)
@@ -1,18 +1,15 @@
 #! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
 
 # Test of gettext facilities in the librep language.
 # Assumes an fr_FR locale is installed.
 # Assumes the following packages are installed: librep.
 
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles prog.jl"
 cat <<\EOF > prog.jl
 (require 'rep.i18n.gettext)
 
 (textdomain "prog")
-(bindtextdomain "prog" "l-librep")
+(bindtextdomain "prog" ".")
 
 (format standard-output "%s\n" (_ "'Your command, please?', asked the waiter."))
 
@@ -20,15 +17,11 @@ cat <<\EOF > prog.jl
         (format nil (_ "%s is replaced by %s.") "FF" "EUR"))
 EOF
 
-tmpfiles="$tmpfiles l-librep-prog.tmp l-librep-prog.pot"
 : ${XGETTEXT=xgettext}
-${XGETTEXT} -o l-librep-prog.tmp --omit-header --no-location prog.jl
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-LC_ALL=C tr -d '\r' < l-librep-prog.tmp > l-librep-prog.pot
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${XGETTEXT} -o prog.tmp --omit-header --no-location prog.jl || exit 1
+LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1
 
-tmpfiles="$tmpfiles l-librep-prog.ok"
-cat <<EOF > l-librep-prog.ok
+cat <<EOF > prog.ok
 msgid "'Your command, please?', asked the waiter."
 msgstr ""
 
@@ -38,10 +31,9 @@ msgstr ""
 EOF
 
 : ${DIFF=diff}
-${DIFF} l-librep-prog.ok l-librep-prog.pot || exit 1
+${DIFF} prog.ok prog.pot || exit 1
 
-tmpfiles="$tmpfiles l-librep-fr.po"
-cat <<\EOF > l-librep-fr.po
+cat <<\EOF > fr.po
 msgid ""
 msgstr ""
 "Content-Type: text/plain; charset=ISO-8859-1\n"
@@ -56,37 +48,32 @@ msgid "%s is replaced by %s."
 msgstr "%2$s remplace %1$s."
 EOF
 
-tmpfiles="$tmpfiles l-librep-fr.po.tmp l-librep-fr.po.new"
 : ${MSGMERGE=msgmerge}
-${MSGMERGE} -q -o l-librep-fr.po.tmp l-librep-fr.po l-librep-prog.pot
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-LC_ALL=C tr -d '\r' < l-librep-fr.po.tmp > l-librep-fr.po.new
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot || exit 1
+LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new || exit 1
 
 : ${DIFF=diff}
-${DIFF} l-librep-fr.po l-librep-fr.po.new || exit 1
+${DIFF} fr.po fr.po.new || exit 1
 
-tmpfiles="$tmpfiles l-librep"
-test -d l-librep || mkdir l-librep
-test -d l-librep/fr || mkdir l-librep/fr
-test -d l-librep/fr/LC_MESSAGES || mkdir l-librep/fr/LC_MESSAGES
+test -d fr || mkdir fr
+test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
 
 : ${MSGFMT=msgfmt}
-${MSGFMT} -o l-librep/fr/LC_MESSAGES/prog.mo l-librep-fr.po
+${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
 
 # Test for presence of rep version 0.15.3 or newer.
 (rep --version) >/dev/null 2>/dev/null \
-  || { echo "Skipping test: rep not found"; rm -fr $tmpfiles; exit 77; }
+  || { echo "Skipping test: rep not found"; exit 77; }
 case `rep --version | sed -e 's/^[^0-9]*//'` in
   0.[0-9] | 0.1[0-5] | 0.[0-9].* | 0.1[0-4].* | 0.15.[0-2] )
-    echo "Skipping test: rep version too old"; rm -fr $tmpfiles; exit 77;;
+    echo "Skipping test: rep version too old"; exit 77;;
 esac
 
 # Test which of the fr_FR locales are installed.
 : ${LOCALE_FR=fr_FR}
 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
 if test $LOCALE_FR != none; then
-  LC_ALL=$LOCALE_FR ./testlocale
+  LC_ALL=$LOCALE_FR ../testlocale
   case $? in
     0) ;;
     77) LOCALE_FR=none;;
@@ -94,7 +81,7 @@ if test $LOCALE_FR != none; then
   esac
 fi
 if test $LOCALE_FR_UTF8 != none; then
-  LC_ALL=$LOCALE_FR_UTF8 ./testlocale
+  LC_ALL=$LOCALE_FR_UTF8 ../testlocale
   case $? in
     0) ;;
     77) LOCALE_FR_UTF8=none;;
@@ -107,16 +94,15 @@ if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
   else
     echo "Skipping test: no french locale is supported"
   fi
-  rm -fr $tmpfiles; exit 77
+  exit 77
 fi
 
-tmpfiles="$tmpfiles l-librep-prog.ok l-librep-prog.oku l-librep-prog.out"
 : ${DIFF=diff}
-cat <<\EOF > l-librep-prog.ok
+cat <<\EOF > prog.ok
 «Votre commande, s'il vous plait», dit le garçon.
 EUR remplace FF.
 EOF
-cat <<\EOF > l-librep-prog.oku
+cat <<\EOF > prog.oku
 «Votre commande, s'il vous plait», dit le garçon.
 EUR remplace FF.
 EOF
@@ -124,14 +110,14 @@ EOF
 : ${LOCALE_FR=fr_FR}
 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
 if test $LOCALE_FR != none; then
-  LANGUAGE= LC_ALL=$LOCALE_FR rep --no-rc --batch prog.jl > l-librep-prog.out || exit 1
-  ${DIFF} l-librep-prog.ok l-librep-prog.out || exit 1
+  prepare_locale_ fr $LOCALE_FR
+  LANGUAGE= LC_ALL=$LOCALE_FR rep --no-rc --batch prog.jl > prog.out || exit 1
+  ${DIFF} prog.ok prog.out || exit 1
 fi
 if test $LOCALE_FR_UTF8 != none; then
-  LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 rep --no-rc --batch prog.jl > l-librep-prog.out || exit 1
-  ${DIFF} l-librep-prog.oku l-librep-prog.out || exit 1
+  prepare_locale_ fr $LOCALE_FR_UTF8
+  LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 rep --no-rc --batch prog.jl > prog.out || exit 1
+  ${DIFF} prog.oku prog.out || exit 1
 fi
 
-rm -fr $tmpfiles
-
 exit 0