#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test basic functioning with Java .properties syntax.
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles mf-p-1"
test -d mf-p-1 || mkdir mf-p-1
test -d mf-p-1/LC_MESSAGES || mkdir mf-p-1/LC_MESSAGES
-tmpfiles="$tmpfiles mf-p-1-1.properties mf-p-1-2.properties"
cat <<\EOF > mf-p-1-1.properties
SYS_(C)\n=MSGFMT(3) portable message object file compiler\nCopyright (C) 1995 Free Software Foundation\nReport bugs to <bug-gnu-utils@gnu.org>\n
msg\ 1=msg 1 translation
# Without use of msgcat, expect a "duplicate message definition" error.
: ${MSGFMT=msgfmt}
if ${MSGFMT} --properties-input -o mf-p-1/LC_MESSAGES/gen.mo mf-p-1-1.properties mf-p-1-2.properties 2> /dev/null; then
- rm -fr $tmpfiles
exit 1
fi
# With msgcat, it should work.
-tmpfiles="$tmpfiles mf-p-1-s.properties"
: ${MSGCAT=msgcat} ${MSGFMT=msgfmt}
-${MSGCAT} --properties-input --properties-output --use-first -o mf-p-1-s.properties mf-p-1-1.properties mf-p-1-2.properties
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-${MSGFMT} --properties-input -o mf-p-1/LC_MESSAGES/gen.mo mf-p-1-s.properties
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${MSGCAT} --properties-input --properties-output --use-first -o mf-p-1-s.properties mf-p-1-1.properties mf-p-1-2.properties || exit 1
+${MSGFMT} --properties-input -o mf-p-1/LC_MESSAGES/gen.mo mf-p-1-s.properties || exit 1
-tmpfiles="$tmpfiles mf-p-test1.out"
: ${GETTEXT=gettext}
TEXTDOMAINDIR=. LANGUAGE=mf-p-1 \
${GETTEXT} --env LC_ALL=en gen 'SYS_(C)
' | LC_ALL=C tr -d '\r' > mf-p-test1.out
-tmpfiles="$tmpfiles gtmf-p-test1.ok"
cat <<EOF > gtmf-p-test1.ok
MSGFMT(3) portable message object file compiler
Copyright (C) 1995 Free Software Foundation
${DIFF} gtmf-p-test1.ok mf-p-test1.out
result=$?
-rm -fr $tmpfiles
-
exit $result