#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test PO extractors with multiple input files.

cat <<EOF > xg-po-2-1.po
msgid "first msgid"
msgid_plural "first msgid (plural)"
msgstr[0] ""
msgstr[1] ""

msgid "second msgid"
msgid_plural "second msgid (plural)"
msgstr[0] ""
msgstr[1] ""
EOF

cat <<EOF > xg-po-2-2.po
msgid "third msgid"
msgid_plural "third msgid (plural)"
msgstr[0] ""
msgstr[1] ""

msgid "second msgid"
msgid_plural "second msgid (plural)"
msgstr[0] ""
msgstr[1] ""
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header xg-po-2-1.po xg-po-2-2.po -o xg-po-2.tmp.po || Exit 1
LC_ALL=C tr -d '\r' < xg-po-2.tmp.po > xg-po-2.po || Exit 1

cat <<EOF > xg-po-2.ok
msgid "first msgid"
msgid_plural "first msgid (plural)"
msgstr[0] ""
msgstr[1] ""

msgid "second msgid"
msgid_plural "second msgid (plural)"
msgstr[0] ""
msgstr[1] ""

msgid "third msgid"
msgid_plural "third msgid (plural)"
msgstr[0] ""
msgstr[1] ""
EOF

: ${DIFF=diff}
${DIFF} xg-po-2.ok xg-po-2.po
result=$?

exit $result
