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