Home | History | Annotate | Line # | Download | only in tests
      1  1.1  christos #! /bin/sh
      2  1.1  christos 
      3  1.1  christos # Test msgcomm on PO files 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 mcomm-test25.in1 mcomm-test25.in2"
      9  1.1  christos cat <<\EOF > mcomm-test25.in1
     10  1.1  christos msgid ""
     11  1.1  christos msgstr ""
     12  1.1  christos "Content-Type: text/plain; charset=UTF-8\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 "Ouverte"
     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 "Ferme"
     34  1.1  christos 
     35  1.1  christos #. A menu item
     36  1.1  christos #~ msgctxt "File|"
     37  1.1  christos #~ msgid "Save As"
     38  1.1  christos #~ msgstr "Enregistrer sous"
     39  1.1  christos EOF
     40  1.1  christos 
     41  1.1  christos cat <<\EOF > mcomm-test25.in2
     42  1.1  christos msgid ""
     43  1.1  christos msgstr ""
     44  1.1  christos "Content-Type: text/plain; charset=UTF-8\n"
     45  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     46  1.1  christos 
     47  1.1  christos #. Denote a lock's state
     48  1.1  christos msgctxt "Lock state"
     49  1.1  christos msgid "Open"
     50  1.1  christos msgstr "Ouvert"
     51  1.1  christos 
     52  1.1  christos #. Denote a lock's state
     53  1.1  christos msgctxt "Lock state"
     54  1.1  christos msgid "Closed"
     55  1.1  christos msgstr "Ferm"
     56  1.1  christos 
     57  1.1  christos #. A product
     58  1.1  christos msgctxt "Audi"
     59  1.1  christos msgid "car"
     60  1.1  christos msgstr "voiture"
     61  1.1  christos 
     62  1.1  christos #. A product
     63  1.1  christos msgctxt "Oc"
     64  1.1  christos msgid "copier"
     65  1.1  christos msgstr "photocopieur"
     66  1.1  christos 
     67  1.1  christos #~ msgid "Save As"
     68  1.1  christos #~ msgstr "Enregistrer l'as"
     69  1.1  christos EOF
     70  1.1  christos 
     71  1.1  christos tmpfiles="$tmpfiles mcomm-test25.out"
     72  1.1  christos : ${MSGCOMM=msgcomm}
     73  1.1  christos ${MSGCOMM} --more-than=0 -o mcomm-test25.out mcomm-test25.in1 mcomm-test25.in2
     74  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     75  1.1  christos 
     76  1.1  christos tmpfiles="$tmpfiles mcomm-test25.ok"
     77  1.1  christos cat <<\EOF > mcomm-test25.ok
     78  1.1  christos msgid ""
     79  1.1  christos msgstr ""
     80  1.1  christos "Content-Type: text/plain; charset=UTF-8\n"
     81  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     82  1.1  christos 
     83  1.1  christos #. A menu item
     84  1.1  christos msgctxt "File|"
     85  1.1  christos msgid "Open"
     86  1.1  christos msgstr "Ouvrir"
     87  1.1  christos 
     88  1.1  christos #. A menu item
     89  1.1  christos msgctxt "File|"
     90  1.1  christos msgid "New"
     91  1.1  christos msgstr "Nouveau"
     92  1.1  christos 
     93  1.1  christos #. Denote a lock's state
     94  1.1  christos msgctxt "Lock state"
     95  1.1  christos msgid "Open"
     96  1.1  christos msgstr "Ouverte"
     97  1.1  christos 
     98  1.1  christos #. Denote a lock's state
     99  1.1  christos msgctxt "Lock state"
    100  1.1  christos msgid "Closed"
    101  1.1  christos msgstr "Ferme"
    102  1.1  christos 
    103  1.1  christos #. A product
    104  1.1  christos msgctxt "Audi"
    105  1.1  christos msgid "car"
    106  1.1  christos msgstr "voiture"
    107  1.1  christos 
    108  1.1  christos #. A product
    109  1.1  christos msgctxt "Oc"
    110  1.1  christos msgid "copier"
    111  1.1  christos msgstr "photocopieur"
    112  1.1  christos 
    113  1.1  christos #. A menu item
    114  1.1  christos #~ msgctxt "File|"
    115  1.1  christos #~ msgid "Save As"
    116  1.1  christos #~ msgstr "Enregistrer sous"
    117  1.1  christos 
    118  1.1  christos #~ msgid "Save As"
    119  1.1  christos #~ msgstr "Enregistrer l'as"
    120  1.1  christos EOF
    121  1.1  christos 
    122  1.1  christos : ${DIFF=diff}
    123  1.1  christos ${DIFF} mcomm-test25.ok mcomm-test25.out
    124  1.1  christos result=$?
    125  1.1  christos 
    126  1.1  christos rm -fr $tmpfiles
    127  1.1  christos 
    128  1.1  christos exit $result
    129