Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-13
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test wrapping long lines.
5 # Both msgid and location comments should wrap at the same column.
6
7 cat <<\EOF > xg-test13.c
8 /* With --width=30, the following 10 gettext calls will produce:
9
10      #: x:1 x:2 x:3 x:4 x:5 x:6 x:7
11      #: x:8 x:9 x:10
12      msgid "a"
13
14    because strlen("#:") + strlen(" x:N") * 7 = 30.  */
15 #line 1 "x"
16 gettext ("a");
17 gettext ("a");
18 gettext ("a");
19 gettext ("a");
20 gettext ("a");
21 gettext ("a");
22 gettext ("a");
23 gettext ("a");
24 gettext ("a");
25 gettext ("a");
26
27 /* And the following gettext call will produce:
28
29     msgid ""
30     "x:1 x:2 x:3 x:4 x:5 x:6 x:7 "
31     "x:8 x:9 x:10"
32
33    because strlen("\"") + strlen("x:N ") * 7 + strlen("\"") = 30.  */
34 gettext ("x:1 x:2 x:3 x:4 x:5 x:6 x:7 x:8 x:9 x:10");
35 EOF
36
37 : ${XGETTEXT=xgettext}
38 ${XGETTEXT} --omit-header --add-location --width=30 -d xg-test13.tmp \
39             xg-test13.c || exit 1
40 LC_ALL=C tr -d '\r' < xg-test13.tmp.po > xg-test13.po || exit 1
41
42 cat <<\EOF > xg-test13.ok
43 #: x:1 x:2 x:3 x:4 x:5 x:6 x:7
44 #: x:8 x:9 x:10
45 msgid "a"
46 msgstr ""
47
48 #: x:19
49 msgid ""
50 "x:1 x:2 x:3 x:4 x:5 x:6 x:7 "
51 "x:8 x:9 x:10"
52 msgstr ""
53 EOF
54
55 : ${DIFF=diff}
56 ${DIFF} xg-test13.ok xg-test13.po
57 result=$?
58
59 exit $result