Home | History | Annotate | Line # | Download | only in tests
      1 #! /bin/sh
      2 
      3 # Test format string checking in plural entries.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles mf-test10.po1"
      9 cat <<\EOF > mf-test10.po1
     10 # SOME DESCRIPTIVE TITLE.
     11 # Copyright (C) YEAR Free Software Foundation, Inc.
     12 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     13 #
     14 msgid ""
     15 msgstr ""
     16 "Project-Id-Version: GNU bison\n"
     17 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
     18 "Last-Translator: ABC DEF <abc (at] gnu.uucp>\n"
     19 "Language-Team: test <test (at] li.org>\n"
     20 "MIME-Version: 1.0\n"
     21 "Content-Type: text/plain; charset=ISO-8859-9\n"
     22 "Content-Transfer-Encoding: 8bit\n"
     23 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
     24 
     25 #: src/reduce.c:511
     26 #, c-format
     27 msgid "%d useless nonterminal"
     28 msgid_plural "%d useless nonterminals"
     29 msgstr[0] "1 yararsz deiken simge"
     30 msgstr[1] "%d yararsz deiken simges"
     31 
     32 #: src/reduce.c:520
     33 #, c-format
     34 msgid "one useless rule"
     35 msgid_plural "%d useless rules"
     36 msgstr[0] "%d yararsz kural"
     37 msgstr[1] "%d yararsz kurals"
     38 EOF
     39 
     40 : ${MSGFMT=msgfmt}
     41 ${MSGFMT} --check -o /dev/null mf-test10.po1
     42 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     43 
     44 tmpfiles="$tmpfiles mf-test10.po2"
     45 cat <<\EOF > mf-test10.po2
     46 # SOME DESCRIPTIVE TITLE.
     47 # Copyright (C) YEAR Free Software Foundation, Inc.
     48 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     49 #
     50 msgid ""
     51 msgstr ""
     52 "Project-Id-Version: GNU bison\n"
     53 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
     54 "Last-Translator: ABC DEF <abc (at] gnu.uucp>\n"
     55 "Language-Team: test <test (at] li.org>\n"
     56 "MIME-Version: 1.0\n"
     57 "Content-Type: text/plain; charset=ISO-8859-9\n"
     58 "Content-Transfer-Encoding: 8bit\n"
     59 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
     60 
     61 #: src/reduce.c:520
     62 #, c-format
     63 msgid "one useless rule"
     64 msgid_plural "%d useless rules"
     65 msgstr[0] "%d yararsz kural"
     66 msgstr[1] "%d yararsz kural%s"
     67 EOF
     68 
     69 tmpfiles="$tmpfiles mf-test10.err"
     70 : ${MSGFMT=msgfmt}
     71 LC_MESSAGES=C LC_ALL= \
     72 ${MSGFMT} --check -o /dev/null mf-test10.po2 \
     73     2>&1 | grep -v '^==' > mf-test10.err
     74 
     75 tmpfiles="$tmpfiles mf-test10.ok"
     76 cat << EOF > mf-test10.ok
     77 mf-test10.po2:20: number of format specifications in 'msgid' and 'msgstr[1]' does not match
     78 msgfmt: found 1 fatal error
     79 EOF
     80 
     81 : ${DIFF=diff}
     82 ${DIFF} mf-test10.ok mf-test10.err
     83 result=$?
     84 
     85 rm -fr $tmpfiles
     86 
     87 exit $result
     88