Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-12
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of msgid_plural extraction in the case of duplicated msgids.
5 # <https://lists.gnu.org/archive/html/bug-gettext/2014-10/msg00028.html>
6
7 cat <<\EOF > xg-test12.c
8 ngettext ("abc", "abc", 1);
9 ngettext ("abc", "abc", 1);
10
11 /* Hypothetical case: plural extraction from a function
12    with a single argument.  */
13 xngettext ("def", 1);
14 xngettext ("def", 1);
15 EOF
16
17 : ${XGETTEXT=xgettext}
18 ${XGETTEXT} --omit-header --add-comments -kngettext:1,1 -kxngettext:1,1 -d xg-test12.tmp xg-test12.c || exit 1
19 LC_ALL=C tr -d '\r' < xg-test12.tmp.po > xg-test12.po || exit 1
20
21 cat <<\EOF > xg-test12.ok
22 #: xg-test12.c:1 xg-test12.c:2
23 msgid "abc"
24 msgid_plural "abc"
25 msgstr[0] ""
26 msgstr[1] ""
27
28 #. Hypothetical case: plural extraction from a function
29 #. with a single argument.
30 #: xg-test12.c:6 xg-test12.c:7
31 msgid "def"
32 msgid_plural "def"
33 msgstr[0] ""
34 msgstr[1] ""
35 EOF
36
37 : ${DIFF=diff}
38 ${DIFF} xg-test12.ok xg-test12.po
39 result=$?
40
41 exit $result