diff options
author | Bruno Haible <bruno@clisp.org> | 2007-10-03 23:36:11 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2007-10-03 23:36:11 +0200 |
commit | 606dd130bdce412935eca78598923720a7e346c4 (patch) | |
tree | 468f6279aa80bac713ebfa7d98b35d9eeaaba339 | |
parent | e0cbd8d3ad576fda177792c4c3ad75a3823f61ee (diff) | |
download | gnulib-606dd130bdce412935eca78598923720a7e346c4.tar.gz |
Test for __fpending function.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | modules/fpending-tests | 10 | ||||
-rw-r--r-- | tests/test-fpending.c | 50 |
3 files changed, 66 insertions, 0 deletions
@@ -1,5 +1,11 @@ 2007-10-03 Bruno Haible <bruno@clisp.org> + * tests/test-fpending.c: New file, mostly copied + from coreutils/lib/t-fpending.c. + * modules/fpending-tests: New file. + +2007-10-03 Bruno Haible <bruno@clisp.org> + Port the stdio extensions to QNX (untested). * lib/fseterr.c (fseterr): Add support for QNX. * lib/fbufmode.c (fbufmode): Likewise. diff --git a/modules/fpending-tests b/modules/fpending-tests new file mode 100644 index 0000000000..0338987a1f --- /dev/null +++ b/modules/fpending-tests @@ -0,0 +1,10 @@ +Files: +tests/test-fpending.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-fpending +check_PROGRAMS += test-fpending diff --git a/tests/test-fpending.c b/tests/test-fpending.c new file mode 100644 index 0000000000..05563f8702 --- /dev/null +++ b/tests/test-fpending.c @@ -0,0 +1,50 @@ +/* Ensure that __fpending works. + + Copyright (C) 2004, 2007 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + Written by Jim Meyering. */ + +#include <config.h> + +#include "fpending.h" + +#include <stdio.h> +#include <stdlib.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main () +{ + ASSERT (__fpending (stdout) == 0); + + fputs ("foo", stdout); + ASSERT (__fpending (stdout) == 3); + + fflush (stdout); + ASSERT (__fpending (stdout) == 0); + + exit (0); +} |