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: extraction of contexts specified in GNOME glib syntax.
      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-15.c"
      9  1.1  christos cat <<\EOF > xg-c-15.c
     10  1.1  christos /* (glib) The 1-argument Q_ macro is a gettext with context. */
     11  1.1  christos print (Q_ ("Printer|Open"));
     12  1.1  christos /* (hypothetical) The 2-argument Q_ macro is an ngettext with contexts. */
     13  1.1  christos print (Q_ ("Menu|Recent File", "Menu|Recent Files"));
     14  1.1  christos EOF
     15  1.1  christos 
     16  1.1  christos tmpfiles="$tmpfiles xg-c-15.po"
     17  1.1  christos : ${XGETTEXT=xgettext}
     18  1.1  christos ${XGETTEXT} --omit-header --no-location \
     19  1.1  christos   --keyword=Q_:1g --keyword=Q_:1g,2g \
     20  1.1  christos   -d xg-c-15 xg-c-15.c
     21  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     22  1.1  christos 
     23  1.1  christos tmpfiles="$tmpfiles xg-c-15.ok"
     24  1.1  christos cat <<EOF > xg-c-15.ok
     25  1.1  christos msgctxt "Printer"
     26  1.1  christos msgid "Open"
     27  1.1  christos msgstr ""
     28  1.1  christos 
     29  1.1  christos msgctxt "Menu"
     30  1.1  christos msgid "Recent File"
     31  1.1  christos msgid_plural "Recent Files"
     32  1.1  christos msgstr[0] ""
     33  1.1  christos msgstr[1] ""
     34  1.1  christos EOF
     35  1.1  christos 
     36  1.1  christos : ${DIFF=diff}
     37  1.1  christos ${DIFF} xg-c-15.ok xg-c-15.po
     38  1.1  christos result=$?
     39  1.1  christos 
     40  1.1  christos rm -fr $tmpfiles
     41  1.1  christos 
     42  1.1  christos exit $result
     43