summaryrefslogtreecommitdiff
path: root/tests-clay/testlib.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-01-02 09:58:39 +0100
committerVicent Martí <tanoku@gmail.com>2012-01-02 09:58:39 +0100
commit7a704309ae012b8e92eb6103b0d14dd3c22a1cb5 (patch)
treea0e917d553db5fc4475be2fff7004268dc36d13d /tests-clay/testlib.c
parent9191a6d2466d0f3c187a66f65757c95c1c3f772d (diff)
parent0fb3fba123d8fbd99a9e1f9f47c192c704daee24 (diff)
downloadlibgit2-7a704309ae012b8e92eb6103b0d14dd3c22a1cb5.tar.gz
Merge remote-tracking branch 'drizzd/diff-index-tests' into development
Conflicts: tests-clay/clay.h tests-clay/clay_main.c
Diffstat (limited to 'tests-clay/testlib.c')
-rw-r--r--tests-clay/testlib.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests-clay/testlib.c b/tests-clay/testlib.c
new file mode 100644
index 000000000..d45fc2c26
--- /dev/null
+++ b/tests-clay/testlib.c
@@ -0,0 +1,20 @@
+#include "clay.h"
+#include "testlib.h"
+#include "posix.h"
+
+void file_create(const char *filename, const char *content)
+{
+ int fd;
+
+ fd = p_creat(filename, 0666);
+ cl_assert(fd != 0);
+
+ if (content) {
+ cl_must_pass(p_write(fd, content, strlen(content)));
+ } else {
+ cl_must_pass(p_write(fd, filename, strlen(filename)));
+ cl_must_pass(p_write(fd, "\n", 1));
+ }
+
+ cl_must_pass(p_close(fd));
+}