#! /bin/sh

# Test C++ support: test --flag that introduces qt-format.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles xg-c-13.cc"
cat <<\EOF > xg-c-13.cc
foo (gettext ("on"));
EOF

tmpfiles="$tmpfiles xg-c-13.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location -d xg-c-13 \
  --flag=foo:1:qt-format --flag=gettext:1:pass-qt-format --qt \
  xg-c-13.cc
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-c-13.ok"
cat <<EOF > xg-c-13.ok
#, qt-format
msgid "on"
msgstr ""
EOF

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

rm -fr $tmpfiles

exit $result
