From: Bruno Haible Date: Sun, 1 Oct 2023 18:18:17 +0000 (+0200) Subject: tests: Check against SIGFPE signal during plural expression evaluation. X-Git-Tag: v0.23~323 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=429ba6c6b835756ceb83f4396580ad5abe36abcf;p=thirdparty%2Fgettext.git tests: Check against SIGFPE signal during plural expression evaluation. * gettext-tools/tests/plural-4: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it. --- diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index 328381101..ed09f3524 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -200,7 +200,7 @@ TESTS = gettext-1 gettext-2 \ format-sh-1 format-sh-2 \ format-tcl-1 format-tcl-2 \ format-ycp-1 format-ycp-2 \ - plural-1 plural-2 plural-3 \ + plural-1 plural-2 plural-3 plural-4 \ gettextpo-1 sentence-1 \ lang-po \ lang-c lang-c++ lang-c++20 lang-objc \ diff --git a/gettext-tools/tests/plural-4 b/gettext-tools/tests/plural-4 new file mode 100644 index 000000000..366075dce --- /dev/null +++ b/gettext-tools/tests/plural-4 @@ -0,0 +1,40 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test that ngettext() does not crash when the plural form rule leads to +# a division by zero. + +test -d plural-4-dir || mkdir plural-4-dir +test -d plural-4-dir/ll || mkdir plural-4-dir/ll +test -d plural-4-dir/ll/LC_MESSAGES || mkdir plural-4-dir/ll/LC_MESSAGES + +cat > plural-4-ll.po < dataout +test $? = 0 || Exit 1 +test x = `cat dataout` || Exit 1 + +Exit 0