xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-c-9 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#!/bin/sh
2
3# Test C support: --add-comments option.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles xg-c-9.c"
9cat <<EOF > xg-c-9.c
10// This comment will not be extracted.
11print (gettext ("help"));
12//  TRANSLATORS: This is an extracted comment.
13print (gettext ("me"));
14/* Not extracted either. */
15print (gettext ("Hey Jude"));
16/*  TRANSLATORS:
17     Nickname of the Beatles
18*/
19print (gettext ("The Fabulous Four"));
20/* TRANSLATORS: The strings get concatenated.  */
21print (gettext ("there is not enough"
22" room on a single line for this entire long, " // confusing, eh?
23"verbose string"));
24EOF
25
26tmpfiles="$tmpfiles xg-c-9.po"
27: ${XGETTEXT=xgettext}
28${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
29  -d xg-c-9 xg-c-9.c
30test $? = 0 || { rm -fr $tmpfiles; exit 1; }
31
32tmpfiles="$tmpfiles xg-c-9.ok"
33cat <<EOF > xg-c-9.ok
34msgid "help"
35msgstr ""
36
37#. TRANSLATORS: This is an extracted comment.
38msgid "me"
39msgstr ""
40
41msgid "Hey Jude"
42msgstr ""
43
44#. TRANSLATORS:
45#. Nickname of the Beatles
46#.
47msgid "The Fabulous Four"
48msgstr ""
49
50#. TRANSLATORS: The strings get concatenated.
51msgid ""
52"there is not enough room on a single line for this entire long, verbose "
53"string"
54msgstr ""
55EOF
56
57: ${DIFF=diff}
58${DIFF} xg-c-9.ok xg-c-9.po
59result=$?
60
61rm -fr $tmpfiles
62
63exit $result
64