Commit 988ea594 by Michael Procter

Test: check restored oom error points to static buffer

parent 0fcfb60d
......@@ -113,22 +113,22 @@ void test_core_errors__restore(void)
void test_core_errors__restore_oom(void)
{
git_error_state err_state = {0};
const char *static_message = NULL;
const git_error *oom_error = NULL;
giterr_clear();
giterr_set_oom(); /* internal fn */
static_message = giterr_last()->message;
oom_error = giterr_last();
cl_assert(oom_error);
cl_assert_equal_i(-1, giterr_capture(&err_state, -1));
cl_assert(giterr_last() == NULL);
cl_assert_(err_state.error_msg.message != static_message, "pointer to static buffer exposed");
giterr_restore(&err_state);
cl_assert(giterr_last()->klass == GITERR_NOMEMORY);
cl_assert_(giterr_last() == oom_error, "static oom error not restored");
giterr_clear();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment