Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-c-17
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test C++ support: test kde-format and format recognition heuristics.
5
6 cat <<\EOF > xg-c-17.cc
7 /* When xgettext has no info, it flags both c-format and kde-format, based
8    on the heuristics.  */
9 gettext ("used time: %1m %2s");
10
11 /* When the programmer says it's kde-format, xgettext does not apply the
12    heuristics.  */
13 /* xgettext: kde-format */
14 gettext ("remaining time: %1m %2s");
15 EOF
16
17 : ${XGETTEXT=xgettext}
18 ${XGETTEXT} --omit-header --no-location -d xg-c-17.tmp --language=C++ --kde \
19   xg-c-17.cc || exit 1
20 LC_ALL=C tr -d '\r' < xg-c-17.tmp.po > xg-c-17.po || exit 1
21
22 cat <<EOF > xg-c-17.ok
23 #, c-format, kde-format
24 msgid "used time: %1m %2s"
25 msgstr ""
26
27 #, kde-format
28 msgid "remaining time: %1m %2s"
29 msgstr ""
30 EOF
31
32 : ${DIFF=diff}
33 ${DIFF} xg-c-17.ok xg-c-17.po
34 result=$?
35
36 exit $result