Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-7
1 #!/bin/sh
2
3 # Test of comment extraction in the case of duplicated msgids.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-test7.c"
9 cat <<\EOF > xg-test7.c
10 /* first comment */
11 /* xgettext: c-format */
12 gettext ("abc");
13
14 /* first comment */
15 /* xgettext: lisp-format */
16 gettext ("abc");
17
18 /* second comment */
19 /* xgettext: python-format */
20 gettext ("abc");
21 EOF
22
23 tmpfiles="$tmpfiles xg-test7.tmp.po xg-test7.po"
24 : ${XGETTEXT=xgettext}
25 ${XGETTEXT} --omit-header --add-comments -d xg-test7.tmp xg-test7.c
26 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
27 LC_ALL=C tr -d '\r' < xg-test7.tmp.po > xg-test7.po
28 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
29
30 tmpfiles="$tmpfiles xg-test7.ok"
31 cat <<\EOF > xg-test7.ok
32 #. first comment
33 #. second comment
34 #: xg-test7.c:3 xg-test7.c:7 xg-test7.c:11
35 #, c-format, python-format, lisp-format
36 msgid "abc"
37 msgstr ""
38 EOF
39
40 : ${DIFF=diff}
41 ${DIFF} xg-test7.ok xg-test7.po
42 result=$?
43
44 rm -fr $tmpfiles
45
46 exit $result