From ff13a286c7769664614d835c09653c83fcb1cb6c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 5 Dec 2004 19:28:15 +0000 Subject: Test the __fpending function. This ensures that if there is an error in the definition of the PENDING_OUTPUT_N_BYTES expression, we'll find about it right away; that value is used only in the rare event that close_stdout's fclose fails with EBADF. --- lib/t-fpending.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/t-fpending.c (limited to 'lib/t-fpending.c') diff --git a/lib/t-fpending.c b/lib/t-fpending.c new file mode 100644 index 000000000..10335cdd0 --- /dev/null +++ b/lib/t-fpending.c @@ -0,0 +1,24 @@ +/* Ensure that __fpending works. */ + +#include +#include +#include + +#include "__fpending.h" + +int +main () +{ + if (__fpending (stdout) != 0) + abort (); + + fputs ("foo", stdout); + if (__fpending (stdout) != 3) + abort (); + + fflush (stdout); + if (__fpending (stdout) != 0) + abort (); + + exit (0); +} -- cgit v1.2.3-54-g00ecf