Home | History | Annotate | Line # | Download | only in tests
      1  1.1  christos #! /bin/sh
      2  1.1  christos 
      3  1.1  christos # Test plural count for locales with nplurals != 2.
      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-test1.pot"
      9  1.1  christos cat <<\EOF > mi-test1.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=CHARSET\n"
     25  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     26  1.1  christos 
     27  1.1  christos #, c-format
     28  1.1  christos msgid "'Your command, please?', asked the waiter."
     29  1.1  christos msgstr ""
     30  1.1  christos 
     31  1.1  christos #, c-format
     32  1.1  christos msgid "a piece of cake"
     33  1.1  christos msgid_plural "%d pieces of cake"
     34  1.1  christos msgstr[0] ""
     35  1.1  christos msgstr[1] ""
     36  1.1  christos 
     37  1.1  christos #, c-format
     38  1.1  christos msgid "%s is replaced by %s."
     39  1.1  christos msgstr ""
     40  1.1  christos EOF
     41  1.1  christos 
     42  1.1  christos tmpfiles="$tmpfiles mi-test1.tmp mi-test1.out mi-test1.err"
     43  1.1  christos : ${MSGINIT=msginit}
     44  1.1  christos ${MSGINIT} -i mi-test1.pot -l ga_IE --no-translator -o mi-test1.tmp 2>mi-test1.err
     45  1.1  christos test $? = 0 || { cat mi-test1.err 1>&2; rm -fr $tmpfiles; exit 1; }
     46  1.1  christos sed -e '1,15d' < mi-test1.tmp > mi-test1.out
     47  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     48  1.1  christos 
     49  1.1  christos tmpfiles="$tmpfiles mi-test1.ok"
     50  1.1  christos cat <<\EOF > mi-test1.ok
     51  1.1  christos "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;\n"
     52  1.1  christos 
     53  1.1  christos #, c-format
     54  1.1  christos msgid "'Your command, please?', asked the waiter."
     55  1.1  christos msgstr ""
     56  1.1  christos 
     57  1.1  christos #, c-format
     58  1.1  christos msgid "a piece of cake"
     59  1.1  christos msgid_plural "%d pieces of cake"
     60  1.1  christos msgstr[0] ""
     61  1.1  christos msgstr[1] ""
     62  1.1  christos msgstr[2] ""
     63  1.1  christos 
     64  1.1  christos #, c-format
     65  1.1  christos msgid "%s is replaced by %s."
     66  1.1  christos msgstr ""
     67  1.1  christos EOF
     68  1.1  christos 
     69  1.1  christos : ${DIFF=diff}
     70  1.1  christos ${DIFF} mi-test1.ok mi-test1.out
     71  1.1  christos result=$?
     72  1.1  christos 
     73  1.1  christos rm -fr $tmpfiles
     74  1.1  christos 
     75  1.1  christos exit $result
     76