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