1#! /bin/sh
2
3# Test C support: comments.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles xg-c-7.c"
9cat <<EOF > xg-c-7.c
10int
11main()
12{
13  /* This is a comment which immediately before a keyword.  */
14  gettext ("1");
15
16  // This
17  // one
18  // too
19  // although many blank lines come before the token itself.
20
21      
22
23
24 gettext("2");
25
26  /* this one also counts */ gettext ("3");
27
28  gettext("4");
29
30  /* this one is also copied */ nada
31  gettext ("5");
32
33  /* I hope you do not see the following */
34  break;
35  gettext("6");
36
37  /* An unnice
38     multi-line comment */ evil;
39  gettext("7");
40}
41EOF
42
43tmpfiles="$tmpfiles xg-c-7.tmp.po xg-c-7.po"
44: ${XGETTEXT=xgettext}
45${XGETTEXT} --omit-header --no-location -c --c++ -d xg-c-7.tmp xg-c-7.c
46test $? = 0 || { rm -fr $tmpfiles; exit 1; }
47tr -d '\r' < xg-c-7.tmp.po > xg-c-7.po
48test $? = 0 || { rm -fr $tmpfiles; exit 1; }
49
50tmpfiles="$tmpfiles xg-c-7.ok"
51cat <<EOF > xg-c-7.ok
52#. This is a comment which immediately before a keyword.
53msgid "1"
54msgstr ""
55
56#. This
57#. one
58#. too
59#. although many blank lines come before the token itself.
60msgid "2"
61msgstr ""
62
63#. this one also counts
64msgid "3"
65msgstr ""
66
67msgid "4"
68msgstr ""
69
70#. this one is also copied
71msgid "5"
72msgstr ""
73
74msgid "6"
75msgstr ""
76
77#. An unnice
78#. multi-line comment
79msgid "7"
80msgstr ""
81EOF
82
83: ${DIFF=diff}
84${DIFF} xg-c-7.ok xg-c-7.po
85result=$?
86
87rm -fr $tmpfiles
88
89exit $result
90
91Local Variables:
92 nuke-trailing-whitespace-p:nil
93End:
94