diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-09-15 01:12:46 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-09-15 01:12:46 +0200 |
commit | f1558d9bcac169681491afff4518cdbbc6e86fb3 (patch) | |
tree | bc3cfc884d48224a6735f32431ec851a387a405b /tests-clay/clay_libgit2.h | |
parent | edb644dd98d8af457a141e539079ac2269c29e3a (diff) | |
download | libgit2-f1558d9bcac169681491afff4518cdbbc6e86fb3.tar.gz |
Come out and Clay
Diffstat (limited to 'tests-clay/clay_libgit2.h')
-rw-r--r-- | tests-clay/clay_libgit2.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests-clay/clay_libgit2.h b/tests-clay/clay_libgit2.h new file mode 100644 index 000000000..ab3cf67ec --- /dev/null +++ b/tests-clay/clay_libgit2.h @@ -0,0 +1,28 @@ +#ifndef __CLAY_LIBGIT2__ +#define __CLAY_LIBGIT2__ + +#include "clay.h" +#include <git2.h> +#include "common.h" + +/** + * Special wrapper for `clay_must_pass` that passes + * the last library error as the test failure message. + * + * Use this wrapper around all `git_` library calls that + * return error codes! + */ +#define cl_git_pass(expr) do { \ + git_clearerror(); \ + if ((expr) != GIT_SUCCESS) \ + clay__assert(0, __FILE__, __LINE__, "Function call failed: " #expr, git_lasterror(), 1); \ + } while(0); + +/** + * Wrapper for `clay_must_fail` -- this one is + * just for consistency. Use with `git_` library + * calls that are supposed to fail! + */ +#define cl_git_fail(expr) cl_must_fail((expr)) + +#endif |