Home | History | Annotate | Line # | Download | only in tests
msginit-2 revision 1.1
      1  1.1  christos #! /bin/sh
      2  1.1  christos 
      3  1.1  christos # Test msginit on a POT file with contexts.
      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 mi-test2.pot"
      9  1.1  christos cat <<\EOF > mi-test2.pot
     10  1.1  christos # SOME DESCRIPTIVE TITLE.
     11  1.1  christos # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     12  1.1  christos # This file is distributed under the same license as the PACKAGE package.
     13  1.1  christos # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     14  1.1  christos #
     15  1.1  christos #, fuzzy
     16  1.1  christos msgid ""
     17  1.1  christos msgstr ""
     18  1.1  christos "Project-Id-Version: PACKAGE VERSION\n"
     19  1.1  christos "Report-Msgid-Bugs-To: \n"
     20  1.1  christos "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     21  1.1  christos "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     22  1.1  christos "Language-Team: LANGUAGE <LL (at] li.org>\n"
     23  1.1  christos "MIME-Version: 1.0\n"
     24  1.1  christos "Content-Type: text/plain; charset=UTF-8\n"
     25  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     26  1.1  christos 
     27  1.1  christos #. A menu item
     28  1.1  christos msgctxt "File|"
     29  1.1  christos msgid "Open"
     30  1.1  christos msgstr ""
     31  1.1  christos 
     32  1.1  christos #. A menu item
     33  1.1  christos msgctxt "File|"
     34  1.1  christos msgid "New"
     35  1.1  christos msgstr ""
     36  1.1  christos 
     37  1.1  christos #. Denote a lock's state
     38  1.1  christos msgctxt "Lock state"
     39  1.1  christos msgid "Open"
     40  1.1  christos msgstr ""
     41  1.1  christos 
     42  1.1  christos #. Denote a lock's state
     43  1.1  christos msgctxt "Lock state"
     44  1.1  christos msgid "Closed"
     45  1.1  christos msgstr ""
     46  1.1  christos 
     47  1.1  christos #. A product
     48  1.1  christos msgctxt "Audi"
     49  1.1  christos msgid "car"
     50  1.1  christos msgstr ""
     51  1.1  christos 
     52  1.1  christos #. A product
     53  1.1  christos msgctxt "Oc"
     54  1.1  christos msgid "copier"
     55  1.1  christos msgstr ""
     56  1.1  christos 
     57  1.1  christos #~ msgid "Save As"
     58  1.1  christos #~ msgstr ""
     59  1.1  christos 
     60  1.1  christos #. A menu item
     61  1.1  christos #~ msgctxt "File|"
     62  1.1  christos #~ msgid "Save As"
     63  1.1  christos #~ msgstr ""
     64  1.1  christos EOF
     65  1.1  christos 
     66  1.1  christos tmpfiles="$tmpfiles mi-test2.tmp mi-test2.out mi-test2.err"
     67  1.1  christos : ${MSGINIT=msginit}
     68  1.1  christos ${MSGINIT} -i mi-test2.pot -l ga_IE --no-translator -o mi-test2.tmp 2>mi-test2.err
     69  1.1  christos test $? = 0 || { cat mi-test2.err 1>&2; rm -fr $tmpfiles; exit 1; }
     70  1.1  christos sed -e '1,15d' < mi-test2.tmp > mi-test2.out
     71  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     72  1.1  christos 
     73  1.1  christos tmpfiles="$tmpfiles mi-test2.ok"
     74  1.1  christos cat <<\EOF > mi-test2.ok
     75  1.1  christos "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;\n"
     76  1.1  christos 
     77  1.1  christos #. A menu item
     78  1.1  christos msgctxt "File|"
     79  1.1  christos msgid "Open"
     80  1.1  christos msgstr ""
     81  1.1  christos 
     82  1.1  christos #. A menu item
     83  1.1  christos msgctxt "File|"
     84  1.1  christos msgid "New"
     85  1.1  christos msgstr ""
     86  1.1  christos 
     87  1.1  christos #. Denote a lock's state
     88  1.1  christos msgctxt "Lock state"
     89  1.1  christos msgid "Open"
     90  1.1  christos msgstr ""
     91  1.1  christos 
     92  1.1  christos #. Denote a lock's state
     93  1.1  christos msgctxt "Lock state"
     94  1.1  christos msgid "Closed"
     95  1.1  christos msgstr ""
     96  1.1  christos 
     97  1.1  christos #. A product
     98  1.1  christos msgctxt "Audi"
     99  1.1  christos msgid "car"
    100  1.1  christos msgstr ""
    101  1.1  christos 
    102  1.1  christos #. A product
    103  1.1  christos msgctxt "Oc"
    104  1.1  christos msgid "copier"
    105  1.1  christos msgstr ""
    106  1.1  christos EOF
    107  1.1  christos 
    108  1.1  christos : ${DIFF=diff}
    109  1.1  christos ${DIFF} mi-test2.ok mi-test2.out
    110  1.1  christos result=$?
    111  1.1  christos 
    112  1.1  christos rm -fr $tmpfiles
    113  1.1  christos 
    114  1.1  christos exit $result
    115