summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-c-3
blob: 182c833c51098a9176a737335110d45600bf115f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/sh

# Test C support: recognition of #line.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles xg-c-3.in.c"
cat <<EOF > xg-c-3.in.c
#line 42 "bozo"
main(){printf(gettext("Hello, World!\n"));}
# 6 "clown"
gettext("nothing");
EOF

tmpfiles="$tmpfiles xg-c-3.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --add-location xg-c-3.in.c -d xg-c-3
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-c-3.ok"
cat <<EOF > xg-c-3.ok
#: bozo:42
#, c-format
msgid "Hello, World!\n"
msgstr ""

#: clown:6
msgid "nothing"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-c-3.ok xg-c-3.po
result=$?

rm -fr $tmpfiles

exit $result