X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fgrab_file%2Ftest%2Frun-grab.c;h=deb466e91d374e120ea9dc812fd96c5cc92cb7b6;hb=100444225380d3f5ca29424ea54703d308c7c651;hp=2b36a0fb70d77ba03b59ae83cb64ab66e6acb56b;hpb=9965fc25fcc92dc76d1cd4cf9595dc3dc9ebc586;p=ccan-lca-2011.git diff --git a/ccan/grab_file/test/run-grab.c b/ccan/grab_file/test/run-grab.c index 2b36a0f..deb466e 100644 --- a/ccan/grab_file/test/run-grab.c +++ b/ccan/grab_file/test/run-grab.c @@ -1,13 +1,13 @@ /* This is test for grab_file() function */ - -#include -#include -#include -#include -#include "string/string.h" -#include "string/string.c" -#include "tap/tap.h" +#include +#include +#include +#include +#include +#include +#include +#include int main(int argc, char *argv[]) @@ -17,15 +17,17 @@ main(int argc, char *argv[]) int length; struct stat st; - str = grab_file(NULL, "ccan/string/test/run-grab.c", NULL); - split = strsplit(NULL, str, "\n", NULL); + str = grab_file(NULL, "test/run-grab.c", NULL); + split = strsplit(NULL, str, "\n"); length = strlen(split[0]); - ok1(streq(split[0], "/* This is test for grab_file() function")); + ok1(!strcmp(split[0], "/* This is test for grab_file() function")); for (i = 1; split[i]; i++) length += strlen(split[i]); - ok1(streq(split[i-1], "/* End of grab_file() test */")); - if (stat("ccan/string/test/run-grab.c", &st) != 0) - err(1, "Could not stat self"); + ok1(!strcmp(split[i-1], "/* End of grab_file() test */")); + if (stat("test/run-grab.c", &st) != 0) + /* FIXME: ditto */ + if (stat("ccan/grab_file/test/run-grab.c", &st) != 0) + err(1, "Could not stat self"); ok1(st.st_size == length + i); return 0;