Home | History | Annotate | Line # | Download | only in tests
      1  1.1  christos #! /bin/sh
      2  1.1  christos 
      3  1.1  christos # Test C support: --add-comments option.
      4  1.1  christos 
      5  1.1  christos tmpfiles=""
      6  1.1  christos trap 'rm -fr $tmpfiles' 1 2 3 15
      7  1.1  christos 
      8  1.1  christos tmpfiles="$tmpfiles xg-c-6.in.C"
      9  1.1  christos cat <<EOF > xg-c-6.in.C
     10  1.1  christos /* This comment will not be extracted.  */
     11  1.1  christos gettext ("help");
     12  1.1  christos 
     13  1.1  christos /*   XXX: But this one will.  */
     14  1.1  christos gettext_noop ("me");
     15  1.1  christos 
     16  1.1  christos //XXX: ..and this
     17  1.1  christos dcgettext ("foo", "quick", LC_MESSAGES);
     18  1.1  christos 
     19  1.1  christos   /* not not not */
     20  1.1  christos dgettext ("bar", "!");
     21  1.1  christos EOF
     22  1.1  christos 
     23  1.1  christos tmpfiles="$tmpfiles xg-c-6.po"
     24  1.1  christos : ${XGETTEXT=xgettext}
     25  1.1  christos ${XGETTEXT} --omit-header --no-location --add-comments=XXX \
     26  1.1  christos   -d xg-c-6 xg-c-6.in.C
     27  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     28  1.1  christos 
     29  1.1  christos tmpfiles="$tmpfiles xg-c-6.ok"
     30  1.1  christos cat <<EOF > xg-c-6.ok
     31  1.1  christos msgid "help"
     32  1.1  christos msgstr ""
     33  1.1  christos 
     34  1.1  christos #. XXX: But this one will.
     35  1.1  christos msgid "me"
     36  1.1  christos msgstr ""
     37  1.1  christos 
     38  1.1  christos #. XXX: ..and this
     39  1.1  christos msgid "quick"
     40  1.1  christos msgstr ""
     41  1.1  christos 
     42  1.1  christos msgid "!"
     43  1.1  christos msgstr ""
     44  1.1  christos EOF
     45  1.1  christos 
     46  1.1  christos : ${DIFF=diff}
     47  1.1  christos ${DIFF} xg-c-6.ok xg-c-6.po
     48  1.1  christos result=$?
     49  1.1  christos 
     50  1.1  christos rm -fr $tmpfiles
     51  1.1  christos 
     52  1.1  christos exit $result
     53