Commit 988ea59443b71f4a07b19fff837ccaa1659dbcc0

Michael Procter 2015-07-27T10:13:49

Test: check restored oom error points to static buffer

diff --git a/tests/core/errors.c b/tests/core/errors.c
index 6aceb30..25bbbd5 100644
--- a/tests/core/errors.c
+++ b/tests/core/errors.c
@@ -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();
 }