Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfmt-2
index 743ab08..4a24487 100755 (executable)
@@ -1,4 +1,5 @@
 #! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
 
 # Test basic functionality, duplicate detection, multiple domains.
 
@@ -14,14 +15,9 @@ else
   ac_n= ac_c='\c' ac_t=
 fi
 
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles mf-2"
 test -d mf-2 || mkdir mf-2
 test -d mf-2/LC_MESSAGES || mkdir mf-2/LC_MESSAGES
 
-tmpfiles="$tmpfiles mf-2-module1.po mf-2-module2.po"
 cat <<EOF > mf-2-module1.po
 #default domain "messages.mo"
 msgid  "SYS_(C)\n"
@@ -60,30 +56,22 @@ EOF
 # Without use of msgcat, expect a "duplicate message definition" error.
 : ${MSGFMT=msgfmt}
 if ${MSGFMT} -o mf-2/LC_MESSAGES/gen.mo mf-2-module1.po mf-2-module2.po 2> /dev/null; then
-  rm -fr $tmpfiles
   exit 1
 fi
 
 # With msgcat, it should work.
-tmpfiles="$tmpfiles mf-2-modules.po"
 : ${MSGCAT=msgcat} ${MSGFMT=msgfmt}
-${MSGCAT} --use-first -o mf-2-modules.po mf-2-module1.po mf-2-module2.po
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-${MSGFMT} -o mf-2/LC_MESSAGES/gen.mo mf-2-modules.po
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${MSGCAT} --use-first -o mf-2-modules.po mf-2-module1.po mf-2-module2.po || exit 1
+${MSGFMT} -o mf-2/LC_MESSAGES/gen.mo mf-2-modules.po || exit 1
 
-tmpfiles="$tmpfiles mf-test2.out"
 : ${GETTEXT=gettext}
 TEXTDOMAINDIR=. LANGUAGE=mf-2 \
 ${GETTEXT} --env LC_ALL=en gen 'error 3' > mf-test2.out
 
-tmpfiles="$tmpfiles gtmf-test2.ok"
 echo $ac_n "error 3 translation$ac_c" > gtmf-test2.ok
 
 : ${DIFF=diff}
 ${DIFF} gtmf-test2.ok mf-test2.out
 result=$?
 
-rm -fr $tmpfiles
-
 exit $result