Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / format-c-5
index 666aea2..7868785 100755 (executable)
@@ -1,18 +1,12 @@
 #! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
 
 # Test 'I' format directive flag.
 
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles fc5.tmp fc5.pot"
 : ${XGETTEXT=xgettext}
-${XGETTEXT} -o fc5.tmp --omit-header --no-location ${top_srcdir}/tests/format-c-5-prg.c
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-LC_ALL=C tr -d '\r' < fc5.tmp > fc5.pot
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${XGETTEXT} -o fc5.tmp --omit-header --no-location "$abs_srcdir"/format-c-5-prg.c || exit 1
+LC_ALL=C tr -d '\r' < fc5.tmp > fc5.pot || exit 1
 
-tmpfiles="$tmpfiles fc5.ok"
 cat <<EOF > fc5.ok
 #, c-format
 msgid "father of %d children"
@@ -22,7 +16,6 @@ EOF
 : ${DIFF=diff}
 ${DIFF} fc5.ok fc5.pot || exit 1
 
-tmpfiles="$tmpfiles fa.po"
 # This should better be Farsi, not German. Can some translator help me?
 cat <<EOF > fa.po
 #, c-format
@@ -30,24 +23,20 @@ msgid "father of %d children"
 msgstr "Vater von %Id Kindern"
 EOF
 
-tmpfiles="$tmpfiles fa"
 test -d fa || mkdir fa
 test -d fa/LC_MESSAGES || mkdir fa/LC_MESSAGES
 
 : ${MSGFMT=msgfmt}
 ${MSGFMT} -o fa/LC_MESSAGES/fc5.mo fa.po
 
-tmpfiles="$tmpfiles fa.po.tmp fa.po.un"
 : ${MSGUNFMT=msgunfmt}
-${MSGUNFMT} -o fa.po.tmp fa/LC_MESSAGES/fc5.mo
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-LC_ALL=C tr -d '\r' < fa.po.tmp > fa.po.un
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${MSGUNFMT} -o fa.po.tmp fa/LC_MESSAGES/fc5.mo || exit 1
+LC_ALL=C tr -d '\r' < fa.po.tmp > fa.po.un || exit 1
 
 : ${DIFF=diff}
 ${DIFF} fa.po fa.po.un || exit 1
 
-LANGUAGE= ./fc5 fa_IR
+LANGUAGE= ../fc5 fa_IR
 case $? in
   0) ;;
   77)
@@ -56,10 +45,8 @@ case $? in
     else
       echo "Skipping test: locale fa_IR not supported"
     fi
-    rm -fr $tmpfiles; exit 77;;
+    exit 77;;
   *) exit 1;;
 esac
 
-rm -fr $tmpfiles
-
 exit 0