diff options
| author | Vicent Martà <vicent@github.com> | 2012-09-25 14:53:13 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-09-25 14:53:13 -0700 |
| commit | 5942bd18bf557cc70873009c4303a421c83f0129 (patch) | |
| tree | 54595289898a934b176b99859a0689ae11a9bce0 /tests-clar | |
| parent | 31d22037a63443c415462bed76dffda5d3c2de2c (diff) | |
| parent | 1a628100534a315bd00361fc3d32df671923c107 (diff) | |
| download | libgit2-5942bd18bf557cc70873009c4303a421c83f0129.tar.gz | |
Merge pull request #947 from arrbee/public-error-set
Make giterr_set_str() and giterr_set_oom() public APIs
Diffstat (limited to 'tests-clar')
| -rw-r--r-- | tests-clar/core/errors.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests-clar/core/errors.c b/tests-clar/core/errors.c index 10c0cdd3f..512a4134d 100644 --- a/tests-clar/core/errors.c +++ b/tests-clar/core/errors.c @@ -1,4 +1,31 @@ #include "clar_libgit2.h" + +void test_core_errors__public_api(void) +{ + char *str_in_error; + + giterr_clear(); + cl_assert(giterr_last() == NULL); + + giterr_set_oom(); + + cl_assert(giterr_last() != NULL); + cl_assert(giterr_last()->klass == GITERR_NOMEMORY); + str_in_error = strstr(giterr_last()->message, "memory"); + cl_assert(str_in_error != NULL); + + giterr_clear(); + + giterr_set_str(GITERR_REPOSITORY, "This is a test"); + + cl_assert(giterr_last() != NULL); + str_in_error = strstr(giterr_last()->message, "This is a test"); + cl_assert(str_in_error != NULL); + + giterr_clear(); + cl_assert(giterr_last() == NULL); +} + #include "common.h" #include "util.h" #include "posix.h" |
