X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-strsignal.c;h=8868346e6fdb49249c67df897ab546e576a4e7c9;hb=217fb89cd467efe0ae1668ac1b69d5cc4742e79b;hp=16544f209debb091d1479777dd39fccff37ada35;hpb=ec1d2ed4fd41d9ff10d11a7a8784293163fb558d;p=gnulib.git diff --git a/tests/test-strsignal.c b/tests/test-strsignal.c index 16544f209..8868346e6 100644 --- a/tests/test-strsignal.c +++ b/tests/test-strsignal.c @@ -30,6 +30,7 @@ if (!(expr)) \ { \ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + fflush (stderr); \ abort (); \ } \ } \ @@ -45,7 +46,11 @@ int main (int argc, char **argv) { - char *str; + /* Work around bug in cygwin 1.5.25 by declaring str as + const char *, even though strsignal is supposed to return char *. + At any rate, this doesn't hurt, since POSIX 200x states that "The + string pointed to shall not be modified by the application." */ + const char *str; /* We try a couple of signals, since not all signals are supported everywhere. Notwithstanding the #ifdef for neatness, SIGINT should in @@ -65,5 +70,17 @@ main (int argc, char **argv) ASSERT_DESCRIPTION (str, "Interrupt"); #endif + /* Test that for out-of-range signal numbers the result is usable. */ + + str = strsignal (-1); + ASSERT (str); + ASSERT (str != (char *) -1); + ASSERT (strlen (str)); + + str = strsignal (9249234); + ASSERT (str); + ASSERT (str != (char *) -1); + ASSERT (strlen (str)); + return 0; }