diff options
Diffstat (limited to 'tests-clar/clar_helpers.c')
| -rw-r--r-- | tests-clar/clar_helpers.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests-clar/clar_helpers.c b/tests-clar/clar_helpers.c index eea8bc87d..1ef5a9bf2 100644 --- a/tests-clar/clar_helpers.c +++ b/tests-clar/clar_helpers.c @@ -27,3 +27,15 @@ void cl_git_mkfile(const char *filename, const char *content) cl_must_pass(p_close(fd)); } + +void cl_git_append2file(const char *filename, const char *new_content) +{ + int fd = p_open(filename, O_WRONLY | O_APPEND | O_CREAT); + cl_assert(fd != 0); + if (!new_content) + new_content = "\n"; + cl_must_pass(p_write(fd, new_content, strlen(new_content))); + cl_must_pass(p_close(fd)); + cl_must_pass(p_chmod(filename, 0644)); +} + |
