summaryrefslogtreecommitdiff
path: root/lib/t-fpending.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-12-05 19:28:15 +0000
committerJim Meyering <jim@meyering.net>2004-12-05 19:28:15 +0000
commitff13a286c7769664614d835c09653c83fcb1cb6c (patch)
tree2253c88a3cfed3817bf9b87c5404a63e7dcd505f /lib/t-fpending.c
parenta2b300f1568b593a5e76c3167e3cb551fc08c2db (diff)
downloadcoreutils-ff13a286c7769664614d835c09653c83fcb1cb6c.tar.xz
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.
Diffstat (limited to 'lib/t-fpending.c')
-rw-r--r--lib/t-fpending.c24
1 files changed, 24 insertions, 0 deletions
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 <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#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);
+}