diff options
Diffstat (limited to 'tests/file_open_test.c')
-rw-r--r-- | tests/file_open_test.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/file_open_test.c b/tests/file_open_test.c new file mode 100644 index 0000000..0132ba0 --- /dev/null +++ b/tests/file_open_test.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <tinydir.h> +#include "cbehave.h" + +FEATURE(file_open, "File open") + SCENARIO("Open file in current directory") + GIVEN("a file in the current directory") + char name[] = "fileXXXXXX"; + int fd = mkstemp(name); + close(fd); + WHEN("we open it") + tinydir_file file; + int r = tinydir_file_open(&file, name); + THEN("the result should be successful") + SHOULD_INT_EQUAL(r, 0); + remove(name); + SCENARIO_END +FEATURE_END + +CBEHAVE_RUN("File open:", TEST_FEATURE(file_open)) |