1 /* This is test for grab_file() function
3 #include "grab_file/grab_file.h"
8 #include "grab_file/grab_file.c"
10 #include "str_talloc/str_talloc.h"
14 main(int argc, char *argv[])
21 str = grab_file(NULL, "test/run-grab.c", NULL);
22 /* FIXME: run_tests runs us from top level dir. Kill this */
24 str = grab_file(NULL, "ccan/grab_file/test/run-grab.c", NULL);
25 split = strsplit(NULL, str, "\n", NULL);
26 length = strlen(split[0]);
27 ok1(streq(split[0], "/* This is test for grab_file() function"));
28 for (i = 1; split[i]; i++)
29 length += strlen(split[i]);
30 ok1(streq(split[i-1], "/* End of grab_file() test */"));
31 if (stat("test/run-grab.c", &st) != 0)
33 if (stat("ccan/grab_file/test/run-grab.c", &st) != 0)
34 err(1, "Could not stat self");
35 ok1(st.st_size == length + i);
40 /* End of grab_file() test */