Home | History | Annotate | Line # | Download | only in tests
      1 #!/bin/sh
      2 
      3 # Test of Python support.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles xg-py-1.py"
      9 cat <<\EOF > xg-py-1.py
     10 # interpret_ansic = true, interpret_unicode = false
     11 _("abc\
     12 \\def\'ghi\"jkl\a\b\f\n\r\t\v x\040x\x7ey\u0142\U00010123\N{LATIN SMALL LETTER Z}");
     13 
     14 # interpret_ansic = false, interpret_unicode = false
     15 _(r"abc\
     16 \\def\'ghi\"jkl\a\b\f\n\r\t\v x\040x\x7ey\u0142\U00010123\N{LATIN SMALL LETTER Z}");
     17 
     18 # interpret_ansic = true, interpret_unicode = true
     19 _(u"abc\
     20 \\def\'ghi\"jkl\a\b\f\n\r\t\v x\040x\x7ey\u0142\U00010123\N{LATIN SMALL LETTER Z}");
     21 
     22 # interpret_ansic = false, interpret_unicode = true
     23 _(ur"abc\
     24 \\def\'ghi\"jkl\a\b\f\n\r\t\v x\040x\x7ey\u0142\U00010123\N{LATIN SMALL LETTER Z}");
     25 EOF
     26 
     27 tmpfiles="$tmpfiles xg-py-1.err xg-py-1.tmp xg-py-1.pot"
     28 : ${XGETTEXT=xgettext}
     29 ${XGETTEXT} --add-comments --no-location -o xg-py-1.tmp xg-py-1.py 2>xg-py-1.err
     30 test $? = 0 || { cat xg-py-1.err; rm -fr $tmpfiles; exit 1; }
     31 grep -v 'POT-Creation-Date' < xg-py-1.tmp > xg-py-1.pot
     32 
     33 tmpfiles="$tmpfiles xg-py-1.ok"
     34 cat <<\EOF > xg-py-1.ok
     35 # SOME DESCRIPTIVE TITLE.
     36 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     37 # This file is distributed under the same license as the PACKAGE package.
     38 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     39 #
     40 #, fuzzy
     41 msgid ""
     42 msgstr ""
     43 "Project-Id-Version: PACKAGE VERSION\n"
     44 "Report-Msgid-Bugs-To: \n"
     45 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     46 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     47 "Language-Team: LANGUAGE <LL (at] li.org>\n"
     48 "MIME-Version: 1.0\n"
     49 "Content-Type: text/plain; charset=UTF-8\n"
     50 "Content-Transfer-Encoding: 8bit\n"
     51 
     52 #. interpret_ansic = true, interpret_unicode = false
     53 msgid ""
     54 "abc\\def'ghi\"jkl\a\b\f\n"
     55 "\r\t\v x x~y\\u0142\\U00010123\\N{LATIN SMALL LETTER Z}"
     56 msgstr ""
     57 
     58 #. interpret_ansic = false, interpret_unicode = false
     59 msgid ""
     60 "abc\\\n"
     61 "\\\\def\\'ghi\\\"jkl\\a\\b\\f\\n\\r\\t\\v x\\040x\\x7ey\\u0142\\U00010123\\N"
     62 "{LATIN SMALL LETTER Z}"
     63 msgstr ""
     64 
     65 #. interpret_ansic = true, interpret_unicode = true
     66 msgid ""
     67 "abc\\def'ghi\"jkl\a\b\f\n"
     68 "\r\t\v x x~yz"
     69 msgstr ""
     70 
     71 #. interpret_ansic = false, interpret_unicode = true
     72 msgid ""
     73 "abc\\\n"
     74 "\\\\def\\'ghi\\\"jkl\\a\\b\\f\\n\\r\\t\\v x\\040x\\x7ey\\U00010123\\N{LATIN "
     75 "SMALL LETTER Z}"
     76 msgstr ""
     77 EOF
     78 
     79 : ${DIFF=diff}
     80 ${DIFF} xg-py-1.ok xg-py-1.pot
     81 result=$?
     82 
     83 rm -fr $tmpfiles
     84 
     85 exit $result
     86