Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-c-2
1 #! /bin/sh
2
3 # Test C support: comments meant for xgettext, and whitespace.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-c-2.in.c"
9 cat <<EOF > xg-c-2.in.c
10 This is a test of the xgettext functionality.
11 /* xgettext:no-c-format */
12 _("extract me")
13 Sometimes keywords can be spread apart
14 xgettext:no-c-format
15 _ ( "what about me" )
16 And even further on accasion
17 _
18 (
19 "hello"
20 )
21 EOF
22
23 tmpfiles="$tmpfiles xg-c-2.tmp.po xg-c-2.po"
24 : ${XGETTEXT=xgettext}
25 ${XGETTEXT} -d xg-c-2.tmp -k_ --omit-header --no-location xg-c-2.in.c
26 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
27 LC_ALL=C tr -d '\r' < xg-c-2.tmp.po > xg-c-2.po
28 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
29
30 tmpfiles="$tmpfiles xg-c-2.ok"
31 cat <<EOF > xg-c-2.ok
32 #, no-c-format
33 msgid "extract me"
34 msgstr ""
35
36 msgid "what about me"
37 msgstr ""
38
39 msgid "hello"
40 msgstr ""
41 EOF
42
43 : ${DIFF=diff}
44 ${DIFF} xg-c-2.ok xg-c-2.po
45 result=$?
46
47 rm -fr $tmpfiles
48
49 exit $result