Home | History | Annotate | Line # | Download | only in tests
      1 #! /bin/sh
      2 
      3 # Test catching of division by zero in plural expression.
      4 
      5 # Note: On AIX 3 with xlc, this test fails. To make it work, add "-qcheck"
      6 # to the CFLAGS, or use gcc.
      7 
      8 tmpfiles=""
      9 trap 'rm -fr $tmpfiles' 1 2 3 15
     10 
     11 tmpfiles="$tmpfiles mf-6.po"
     12 cat <<EOF > mf-6.po
     13 msgid ""
     14 msgstr ""
     15 "Project-Id-Version: msgfmt test 4\n"
     16 "PO-Revision-Date: 2001-09-23 15:03+0200\n"
     17 "Last-Translator: Bruno Haible <haible (at] clisp.cons.org>\n"
     18 "Language-Team: test <test (at] li.org>\n"
     19 "MIME-Version: 1.0\n"
     20 "Content-Type: text/plain; charset=ASCII\n"
     21 "Content-Transfer-Encoding: 8bit\n"
     22 "Plural-Forms: nplurals=3; plural=(1 + (1 / (n - 257)));\n"
     23 EOF
     24 
     25 tmpfiles="$tmpfiles mf-6.mo core *.core"
     26 : ${MSGFMT=msgfmt}
     27 ${MSGFMT} --check -o mf-6.mo mf-6.po 2>/dev/null
     28 # Exit code must be 1.
     29 # If the division by zero didn't get noticed, it would be 0.
     30 # If it produced a core dump, it would be 136 (= 128 + SIGFPE).
     31 test $? = 1
     32 result=$?
     33 
     34 rm -fr $tmpfiles
     35 
     36 exit $result
     37