]> git.ozlabs.org Git - ccan/blobdiff - ccan/tap/test/run.c
tap: spelling fix
[ccan] / ccan / tap / test / run.c
index 26957fb5c04b601bca73f7a19b26b90949f1d080..37f26ae0277a418365cd46e6dc5c7d04759c59b6 100644 (file)
@@ -2,17 +2,17 @@
  * any output, and change stdout and stderr to use that.
  *
  * Since we don't use libtap for output, this looks like one big test. */
  * any output, and change stdout and stderr to use that.
  *
  * Since we don't use libtap for output, this looks like one big test. */
-#include "tap/tap.h"
+#include <ccan/tap/tap.h>
+#include <ccan/tap/tap.c>
 #include <stdio.h>
 #include <stdio.h>
-#include <unistd.h>
-#include <stdarg.h>
+#include <limits.h>
 #include <err.h>
 #include <string.h>
 #include <err.h>
 #include <string.h>
-#include <stdlib.h>
-#include <limits.h>
 #include <stdbool.h>
 #include <fnmatch.h>
 
 #include <stdbool.h>
 #include <fnmatch.h>
 
+
+
 /* We dup stderr to here. */
 static int stderrfd;
 
 /* We dup stderr to here. */
 static int stderrfd;
 
@@ -66,8 +66,8 @@ int main(int argc, char *argv[])
        int p[2];
        int stdoutfd;
 
        int p[2];
        int stdoutfd;
 
+       setbuf(stdout, 0);
        printf("1..1\n");
        printf("1..1\n");
-       fflush(stdout);
        stderrfd = dup(STDERR_FILENO);
        if (stderrfd < 0)
                err(1, "dup of stderr failed");
        stderrfd = dup(STDERR_FILENO);
        if (stderrfd < 0)
                err(1, "dup of stderr failed");
@@ -90,21 +90,21 @@ int main(int argc, char *argv[])
 
        ok(0, "msg2");
        expect(p[0], "not ok 2 - msg2\n"
 
        ok(0, "msg2");
        expect(p[0], "not ok 2 - msg2\n"
-              "#     Failed test (*tap/test/run.c:main() at line 77)\n");
+              "#     Failed test (*test/run.c:main() at line 91)\n");
 
        ok1(true);
        expect(p[0], "ok 3 - true\n");
 
        ok1(false);
        expect(p[0], "not ok 4 - false\n"
 
        ok1(true);
        expect(p[0], "ok 3 - true\n");
 
        ok1(false);
        expect(p[0], "not ok 4 - false\n"
-              "#     Failed test (*tap/test/run.c:main() at line 84)\n");
+              "#     Failed test (*test/run.c:main() at line 98)\n");
 
        pass("passed");
        expect(p[0], "ok 5 - passed\n");
 
        fail("failed");
        expect(p[0], "not ok 6 - failed\n"
 
        pass("passed");
        expect(p[0], "ok 5 - passed\n");
 
        fail("failed");
        expect(p[0], "not ok 6 - failed\n"
-              "#     Failed test (*tap/test/run.c:main() at line 91)\n");
+              "#     Failed test (*test/run.c:main() at line 105)\n");
 
        skip(2, "skipping %s", "test");
        expect(p[0], "ok 7 # skip skipping test\n"
 
        skip(2, "skipping %s", "test");
        expect(p[0], "ok 7 # skip skipping test\n"
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
        todo_start("todo");
        ok1(false);
        expect(p[0], "not ok 9 - false # TODO todo\n"
        todo_start("todo");
        ok1(false);
        expect(p[0], "not ok 9 - false # TODO todo\n"
-              "#     Failed (TODO) test (*tap/test/run.c:main() at line 100)\n");
+              "#     Failed (TODO) test (*test/run.c:main() at line 114)\n");
        ok1(true);
        expect(p[0], "ok 10 - true # TODO todo\n");
        todo_end();
        ok1(true);
        expect(p[0], "ok 10 - true # TODO todo\n");
        todo_end();
@@ -129,5 +129,5 @@ int main(int argc, char *argv[])
 
        write_all(stdoutfd, "ok 1 - All passed\n",
                  strlen("ok 1 - All passed\n"));
 
        write_all(stdoutfd, "ok 1 - All passed\n",
                  strlen("ok 1 - All passed\n"));
-       _exit(0);
+       exit(0);
 }
 }