Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfilter-1
index 6241e44..c1569a0 100755 (executable)
@@ -1,10 +1,8 @@
 #! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
 
 # Test general filter execution.
 
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -21,13 +19,13 @@ fi
 # spaces.
 echo abc | fold -b -s -w 20 >/dev/null 2>&1 || {
   echo "Skipping test: fold program not POSIX compliant"
-  rm -fr $tmpfiles; exit 77
+  exit 77
 }
 
 # Some fold programs (like NetBSD 5.0) remove trailing spaces when wrapping.
 echo ab cd | fold -b -s -w 3 | grep ' ' >/dev/null || {
   echo "Skipping test: fold program trims trailing spaces"
-  rm -fr $tmpfiles; exit 77
+  exit 77
 }
 
 # Some fold programs (like HP-UX) insert a newline at the end, if the last
@@ -36,10 +34,9 @@ foldoutputcount=`echo $ac_n "abc$ac_c" | fold -b -s -w 20 | wc -c`
 foldoutputcount=`echo "$foldoutputcount" | sed -e 's/[         ]//g'`
 test "$foldoutputcount" = 3 || {
   echo "Skipping test: fold program inserts extra newline"
-  rm -fr $tmpfiles; exit 77
+  exit 77
 }
 
-tmpfiles="$tmpfiles mfi-test1.po"
 cat <<\EOF > mfi-test1.po
 # HEADER.
 #
@@ -90,15 +87,13 @@ msgstr ""
 #~ msgstr "das einen verheirateten Mann liebt"
 EOF
 
-tmpfiles="$tmpfiles mfi-test1.out mfi-test1.err"
 : ${MSGFILTER=msgfilter}
 LC_ALL=C \
 ${MSGFILTER} -i mfi-test1.po -o mfi-test1.out fold -b -s -w 20 >mfi-test1.err 2>&1
 result=$?
 cat mfi-test1.err | grep -v 'warning: Locale charset' | grep -v '^ '
-test $result = 0 || { rm -fr $tmpfiles; exit 1; }
+test $result = 0 || { exit 1; }
 
-tmpfiles="$tmpfiles mfi-test1.ok"
 cat <<\EOF > mfi-test1.ok
 # HEADER.
 #
@@ -171,6 +166,4 @@ EOF
 ${DIFF} mfi-test1.ok mfi-test1.out
 result=$?
 
-rm -fr $tmpfiles
-
 exit $result