Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-c-18
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test C support: extraction of 'range:' flags.
5
6 cat <<\EOF > xg-c-18.c
7 if (days > 7 && days < 14)
8   /* xgettext: range: 1..6 */
9   printf (ngettext ("one week and one day", "one week and %d days",
10                     days - 7),
11           days - 7);
12 EOF
13
14 : ${XGETTEXT=xgettext}
15 ${XGETTEXT} --omit-header --no-location -d xg-c-18.tmp xg-c-18.c || exit 1
16 LC_ALL=C tr -d '\r' < xg-c-18.tmp.po > xg-c-18.po || exit 1
17
18 cat <<EOF > xg-c-18.ok
19 #, c-format, range: 1..6
20 msgid "one week and one day"
21 msgid_plural "one week and %d days"
22 msgstr[0] ""
23 msgstr[1] ""
24 EOF
25
26 : ${DIFF=diff}
27 ${DIFF} xg-c-18.ok xg-c-18.po
28 result=$?
29
30 exit $result