Home | History | Annotate | Line # | Download | only in tests
xgettext-c-14 revision 1.1.1.1
      1 #! /bin/sh
      2 
      3 # Test C++ support: test boost-format.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles xg-c-14.cc"
      9 cat <<\EOF > xg-c-14.cc
     10 // These are recognized as boost-format because of the keyword 'format'.
     11 format(gettext("%s on, %s off"));
     12 format(gettext("%1$d on, %2$d off"));
     13 format(gettext("%|1$| on, %|2$| off"));
     14 format(gettext("%1% on, %2% off"));
     15 // These are recognized as boost-format only through the heuristics.
     16 gettext("heuristic %s on, %s off");
     17 gettext("heuristic %1$d on, %2$d off");
     18 gettext("heuristic %|1$| on, %|2$| off");
     19 gettext("heuristic %1% on, %2% off");
     20 EOF
     21 
     22 tmpfiles="$tmpfiles xg-c-14.po"
     23 : ${XGETTEXT=xgettext}
     24 ${XGETTEXT} --omit-header --no-location -d xg-c-14 --boost xg-c-14.cc
     25 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     26 
     27 # The first 4 are not marked as c-format, because they are known as
     28 # boost-format. The last 4 are governed by the heuristic. The first two
     29 # among them are valid c-format strings. The last one is a valid but unlikely
     30 # c-format string, therefore the heuristic doesn't mark it.
     31 tmpfiles="$tmpfiles xg-c-14.ok"
     32 cat <<\EOF > xg-c-14.ok
     33 #, boost-format
     34 msgid "%s on, %s off"
     35 msgstr ""
     36 
     37 #, boost-format
     38 msgid "%1$d on, %2$d off"
     39 msgstr ""
     40 
     41 #, boost-format
     42 msgid "%|1$| on, %|2$| off"
     43 msgstr ""
     44 
     45 #, boost-format
     46 msgid "%1% on, %2% off"
     47 msgstr ""
     48 
     49 #, c-format, boost-format
     50 msgid "heuristic %s on, %s off"
     51 msgstr ""
     52 
     53 #, c-format, boost-format
     54 msgid "heuristic %1$d on, %2$d off"
     55 msgstr ""
     56 
     57 #, boost-format
     58 msgid "heuristic %|1$| on, %|2$| off"
     59 msgstr ""
     60 
     61 #, boost-format
     62 msgid "heuristic %1% on, %2% off"
     63 msgstr ""
     64 EOF
     65 
     66 : ${DIFF=diff}
     67 ${DIFF} xg-c-14.ok xg-c-14.po
     68 result=$?
     69 
     70 rm -fr $tmpfiles
     71 
     72 exit $result
     73