X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Frbuf%2Ftest%2Frun-open.c;fp=ccan%2Frbuf%2Ftest%2Frun-open.c;h=5678e42e9bf7191920d5ed306006359c7af5dfca;hb=44b37ee8aeb185f6837378fef17d887bda6ff89b;hp=0000000000000000000000000000000000000000;hpb=72ce81407f677cf279eb46b1c90c34316067b674;p=ccan diff --git a/ccan/rbuf/test/run-open.c b/ccan/rbuf/test/run-open.c new file mode 100644 index 00000000..5678e42e --- /dev/null +++ b/ccan/rbuf/test/run-open.c @@ -0,0 +1,25 @@ +#include +/* Include the C files directly. */ +#include +#include +#include +#include +#include +#include + +int main(void) +{ + struct rbuf in; + + /* This is how many tests you plan to run */ + plan_tests(5); + + ok1(!rbuf_open(&in, "nonexistent-file", NULL, 0)); + ok1(errno == ENOENT); + ok1(rbuf_open(&in, "test/run-open.c", NULL, 0)); + ok1(close(in.fd) == 0); + /* If this fails to stat, it should fall back */ + ok1(rbuf_good_size(in.fd) == 4096); + + return exit_status(); +}