1 #include <ccan/oserver/oserver.h>
2 #include <ccan/oserver/oserver.c>
3 #include <ccan/str/str.h>
4 #include <ccan/foreach/foreach.h>
5 #include <ccan/tap/tap.h>
18 /* This is how many tests you plan to run */
25 "This is a test\nWith extra",
26 "This is a test\rWith extra",
27 "This is a test\r\nWith extra") {
28 fd = open("run-fd", O_RDWR|O_CREAT|O_TRUNC, 0600);
30 write(fd, input, strlen(input));
31 lseek(fd, 0, SEEK_SET);
33 ok1(oserver_serve(fd));
35 lseek(fd, 0, SEEK_SET);
36 buf[read(fd, buf, sizeof(buf)-1)] = '\0';
38 ok1(strncmp(buf, input, strlen("This is a test")) == 0);
39 ok1(streq(buf + strlen("This is a test") + 1,
40 "Louder, like this: 'THIS IS A TEST'\r\n"));
43 /* This exits depending on whether all tests passed */