summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-c-18
blob: deac1f0454f8aceb9a1a10efc5b850c5b3cc6334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test C support: extraction of 'range:' flags.

cat <<\EOF > xg-c-18.c
if (days > 7 && days < 14)
  /* xgettext: range: 1..6 */
  printf (ngettext ("one week and one day", "one week and %d days",
                    days - 7),
          days - 7);
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location -d xg-c-18.tmp xg-c-18.c || exit 1
LC_ALL=C tr -d '\r' < xg-c-18.tmp.po > xg-c-18.po || exit 1

cat <<EOF > xg-c-18.ok
#, c-format, range: 1..6
msgid "one week and one day"
msgid_plural "one week and %d days"
msgstr[0] ""
msgstr[1] ""
EOF

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

exit $result