• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7cat <<\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"
16gettext ("a");
17gettext ("a");
18gettext ("a");
19gettext ("a");
20gettext ("a");
21gettext ("a");
22gettext ("a");
23gettext ("a");
24gettext ("a");
25gettext ("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.  */
34gettext ("x:1 x:2 x:3 x:4 x:5 x:6 x:7 x:8 x:9 x:10");
35EOF
36
37: ${XGETTEXT=xgettext}
38${XGETTEXT} --omit-header --add-location --width=30 -d xg-test13.tmp \
39            xg-test13.c || Exit 1
40LC_ALL=C tr -d '\r' < xg-test13.tmp.po > xg-test13.po || Exit 1
41
42cat <<\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
45msgid "a"
46msgstr ""
47
48#: x:19
49msgid ""
50"x:1 x:2 x:3 x:4 x:5 x:6 x:7 "
51"x:8 x:9 x:10"
52msgstr ""
53EOF
54
55: ${DIFF=diff}
56${DIFF} xg-test13.ok xg-test13.po
57result=$?
58
59exit $result
60