Move to here from test-fprintf-posix.out.
[gnulib.git] / tests / test-fbufmode.c
index af4fa88..044d872 100644 (file)
 
 #include "fbufmode.h"
 
+#include <stdio.h>
 #include <stdlib.h>
 
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+  do                                                                        \
+    {                                                                       \
+      if (!(expr))                                                          \
+        {                                                                   \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          abort ();                                                         \
+        }                                                                   \
+    }                                                                       \
+  while (0)
 
 #define TESTFILE "t-fbufmode.tmp"
 
@@ -52,7 +62,9 @@ main ()
   /* This setvbuf call can fail, e.g. on HP-UX 11.  */
   if (setvbuf (fp, buf, _IOLBF, 5) == 0)
     {
-      ASSERT (fbufmode (fp) == _IOLBF);
+      /* mingw's setvbuf implements _IOLBF the same way as _IOFBF.  */
+      ASSERT (fbufmode (fp) == _IOLBF
+             || fbufmode (fp) == _IOFBF);
     }
 
   /* This setvbuf call can fail, e.g. on HP-UX 11.  */