Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-2
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Even an empty string is extracted, if not overridden by xgettext's
5 # default-constructed header entry.
6
7 cat <<EOF > xg-test2.in.c
8 This is a test of the xgettext functionality.
9 /* xgettext:no-c-format */
10 _("extract me")
11 Sometimes keywords can be spread apart
12 xgettext:no-c-format
13 _ ( "what about me" )
14 And even further on occasion
15 _
16 (
17 "hello"
18 )
19
20 /* also empty strings */
21 _("")
22 EOF
23
24 : ${XGETTEXT=xgettext}
25 ${XGETTEXT} -d xg-test2.tmp -k_ --omit-header --no-location xg-test2.in.c || exit 1
26 LC_ALL=C tr -d '\r' < xg-test2.tmp.po > xg-test2.po || exit 1
27
28 cat <<EOF > xg-test2.ok
29 #, no-c-format
30 msgid "extract me"
31 msgstr ""
32
33 msgid "what about me"
34 msgstr ""
35
36 msgid "hello"
37 msgstr ""
38
39 msgid ""
40 msgstr ""
41 EOF
42
43 : ${DIFF=diff}
44 ${DIFF} xg-test2.ok xg-test2.po
45 result=$?
46
47 exit $result