diff options
author | Vicent Marti <tanoku@gmail.com> | 2012-05-19 03:46:11 +0400 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2012-05-19 03:46:11 +0400 |
commit | 5b9fac39d8a76b9139667c26a63e6b3f204b3977 (patch) | |
tree | e6ba28025f92c16563c4ffa8bc60b95f17d69691 /tests-clar/clar_libgit2.h | |
parent | 7ef9f1b5606c2672105ecbbf34c022a71ef212fe (diff) | |
parent | ad5df35a47d56c3d716d7a56eac4aeb611987c11 (diff) |
Merge branch 'development'v0.17.0
Conflicts:
.travis.yml
Diffstat (limited to 'tests-clar/clar_libgit2.h')
-rw-r--r-- | tests-clar/clar_libgit2.h | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h index 73ef66844..d250494f5 100644 --- a/tests-clar/clar_libgit2.h +++ b/tests-clar/clar_libgit2.h @@ -13,9 +13,9 @@ * return error codes! */ #define cl_git_pass(expr) do { \ - git_clearerror(); \ - if ((expr) != GIT_SUCCESS) \ - clar__assert(0, __FILE__, __LINE__, "Function call failed: " #expr, git_lasterror(), 1); \ + giterr_clear(); \ + if ((expr) != 0) \ + clar__assert(0, __FILE__, __LINE__, "Function call failed: " #expr, giterr_last() ? giterr_last()->message : NULL, 1); \ } while(0) /** @@ -25,23 +25,6 @@ */ #define cl_git_fail(expr) cl_must_fail(expr) -/** - * Wrapper for string comparison that knows about nulls. - */ -#define cl_assert_strequal(a,b) \ - cl_assert_strequal_internal(a,b,__FILE__,__LINE__,"string mismatch: " #a " != " #b) - -GIT_INLINE(void) cl_assert_strequal_internal( - const char *a, const char *b, const char *file, int line, const char *err) -{ - int match = (a == NULL || b == NULL) ? (a == b) : (strcmp(a, b) == 0); - if (!match) { - char buf[4096]; - snprintf(buf, 4096, "'%s' != '%s'", a, b); - clar__assert(0, file, line, buf, err, 1); - } -} - /* * Some utility macros for building long strings */ @@ -53,5 +36,13 @@ GIT_INLINE(void) cl_assert_strequal_internal( /* Write the contents of a buffer to disk */ void cl_git_mkfile(const char *filename, const char *content); +void cl_git_append2file(const char *filename, const char *new_content); +void cl_git_rewritefile(const char *filename, const char *new_content); +void cl_git_write2file(const char *filename, const char *new_content, int mode); + +/* Git sandbox setup helpers */ + +git_repository *cl_git_sandbox_init(const char *sandbox); +void cl_git_sandbox_cleanup(void); #endif |