Home | History | Annotate | Line # | Download | only in tests
msgconv-5 revision 1.1
      1  1.1  christos #! /bin/sh
      2  1.1  christos 
      3  1.1  christos # Test msgconv on a PO 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 mco-test5.po"
      9  1.1  christos cat <<\EOF > mco-test5.po
     10  1.1  christos msgid ""
     11  1.1  christos msgstr ""
     12  1.1  christos "Content-Type: text/plain; charset=ISO-8859-1\n"
     13  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     14  1.1  christos 
     15  1.1  christos #. A menu item
     16  1.1  christos msgctxt "File|"
     17  1.1  christos msgid "Open"
     18  1.1  christos msgstr "Ouvrir"
     19  1.1  christos 
     20  1.1  christos #. A menu item
     21  1.1  christos msgctxt "File|"
     22  1.1  christos msgid "New"
     23  1.1  christos msgstr "Nouveau"
     24  1.1  christos 
     25  1.1  christos #. Denote a lock's state
     26  1.1  christos msgctxt "Lock state"
     27  1.1  christos msgid "Open"
     28  1.1  christos msgstr "Ouvert"
     29  1.1  christos 
     30  1.1  christos #. Denote a lock's state
     31  1.1  christos msgctxt "Lock state"
     32  1.1  christos msgid "Closed"
     33  1.1  christos msgstr "Ferm"
     34  1.1  christos 
     35  1.1  christos #. A product
     36  1.1  christos msgctxt "Audi"
     37  1.1  christos msgid "car"
     38  1.1  christos msgstr "voiture"
     39  1.1  christos 
     40  1.1  christos #. A product
     41  1.1  christos msgctxt "Oc"
     42  1.1  christos msgid "copier"
     43  1.1  christos msgstr "photocopieur"
     44  1.1  christos 
     45  1.1  christos #~ msgid "Save As"
     46  1.1  christos #~ msgstr "Enregistrer l'as"
     47  1.1  christos 
     48  1.1  christos #. A menu item
     49  1.1  christos #~ msgctxt "File|"
     50  1.1  christos #~ msgid "Save As"
     51  1.1  christos #~ msgstr "Enregistrer sous"
     52  1.1  christos EOF
     53  1.1  christos 
     54  1.1  christos tmpfiles="$tmpfiles mco-test5.out"
     55  1.1  christos : ${MSGCONV=msgconv}
     56  1.1  christos ${MSGCONV} --to-code=UTF-8 -o mco-test5.out mco-test5.po
     57  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     58  1.1  christos 
     59  1.1  christos tmpfiles="$tmpfiles mco-test5.ok"
     60  1.1  christos cat <<\EOF > mco-test5.ok
     61  1.1  christos msgid ""
     62  1.1  christos msgstr ""
     63  1.1  christos "Content-Type: text/plain; charset=UTF-8\n"
     64  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     65  1.1  christos 
     66  1.1  christos #. A menu item
     67  1.1  christos msgctxt "File|"
     68  1.1  christos msgid "Open"
     69  1.1  christos msgstr "Ouvrir"
     70  1.1  christos 
     71  1.1  christos #. A menu item
     72  1.1  christos msgctxt "File|"
     73  1.1  christos msgid "New"
     74  1.1  christos msgstr "Nouveau"
     75  1.1  christos 
     76  1.1  christos #. Denote a lock's state
     77  1.1  christos msgctxt "Lock state"
     78  1.1  christos msgid "Open"
     79  1.1  christos msgstr "Ouvert"
     80  1.1  christos 
     81  1.1  christos #. Denote a lock's state
     82  1.1  christos msgctxt "Lock state"
     83  1.1  christos msgid "Closed"
     84  1.1  christos msgstr "Ferm"
     85  1.1  christos 
     86  1.1  christos #. A product
     87  1.1  christos msgctxt "Audi"
     88  1.1  christos msgid "car"
     89  1.1  christos msgstr "voiture"
     90  1.1  christos 
     91  1.1  christos #. A product
     92  1.1  christos msgctxt "Oc"
     93  1.1  christos msgid "copier"
     94  1.1  christos msgstr "photocopieur"
     95  1.1  christos 
     96  1.1  christos #~ msgid "Save As"
     97  1.1  christos #~ msgstr "Enregistrer l'as"
     98  1.1  christos 
     99  1.1  christos #. A menu item
    100  1.1  christos #~ msgctxt "File|"
    101  1.1  christos #~ msgid "Save As"
    102  1.1  christos #~ msgstr "Enregistrer sous"
    103  1.1  christos EOF
    104  1.1  christos 
    105  1.1  christos : ${DIFF=diff}
    106  1.1  christos ${DIFF} mco-test5.ok mco-test5.out
    107  1.1  christos result=$?
    108  1.1  christos 
    109  1.1  christos rm -fr $tmpfiles
    110  1.1  christos 
    111  1.1  christos exit $result
    112