xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-c-3 (revision 32d1c65c71fbdb65a012e8392a62a757dd6853e9)
1#! /bin/sh
2
3# Test C support: recognition of #line.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles xg-c-3.in.c"
9cat <<EOF > xg-c-3.in.c
10#line 42 "bozo"
11main(){printf(gettext("Hello, World!\n"));}
12# 6 "clown"
13gettext("nothing");
14EOF
15
16tmpfiles="$tmpfiles xg-c-3.po"
17: ${XGETTEXT=xgettext}
18${XGETTEXT} --omit-header --add-location -d xg-c-3 xg-c-3.in.c
19test $? = 0 || { rm -fr $tmpfiles; exit 1; }
20
21tmpfiles="$tmpfiles xg-c-3.ok"
22cat <<EOF > xg-c-3.ok
23#: bozo:42
24#, c-format
25msgid "Hello, World!\n"
26msgstr ""
27
28#: clown:6
29msgid "nothing"
30msgstr ""
31EOF
32
33: ${DIFF=diff}
34${DIFF} xg-c-3.ok xg-c-3.po
35result=$?
36
37rm -fr $tmpfiles
38
39exit $result
40