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

# Test heuristic recognition of Boost format strings like "100% complete".

cat <<\EOF > f-bo-3.cc
gettext("Test 1a is 100% complete");
format(gettext("Test 1b is 100% complete"), 120);
gettext("Test 2a from 0% complete to 100% complete");
format(gettext("Test 2b from 0% complete to 100% complete"), 120, 121);
gettext("Test 3a of %s is 100% complete");
format(gettext("Test 3b of %s is 100% complete"), "foo", 120);
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} --boost --omit-header --no-location -d f-bo-3.tmp f-bo-3.cc || Exit 1
LC_ALL=C tr -d '\r' < f-bo-3.tmp.po > f-bo-3.po || Exit 1

cat <<\EOF > f-bo-3.ok
msgid "Test 1a is 100% complete"
msgstr ""

#, boost-format
msgid "Test 1b is 100% complete"
msgstr ""

msgid "Test 2a from 0% complete to 100% complete"
msgstr ""

#, boost-format
msgid "Test 2b from 0% complete to 100% complete"
msgstr ""

#, c-format, boost-format
msgid "Test 3a of %s is 100% complete"
msgstr ""

#, boost-format
msgid "Test 3b of %s is 100% complete"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} f-bo-3.ok f-bo-3.po
result=$?

exit $result
