From: Ondřej Surý Date: Tue, 23 Jul 2019 15:55:19 +0000 (-0400) Subject: Adjust tkey_test.c test to mock_assert() when there's no memory X-Git-Tag: v9.15.3~32^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9123da5362afba0e8f210ffd140cd2715a9036c5;p=thirdparty%2Fbind9.git Adjust tkey_test.c test to mock_assert() when there's no memory --- diff --git a/lib/dns/tests/tkey_test.c b/lib/dns/tests/tkey_test.c index 805258ad0da..8727f1eddd3 100644 --- a/lib/dns/tests/tkey_test.c +++ b/lib/dns/tests/tkey_test.c @@ -47,9 +47,9 @@ __wrap_isc__mem_get(isc_mem_t *mctx, size_t size) UNUSED(mctx); - if (!has_enough_memory) { - return (NULL); - } + mock_assert(has_enough_memory, "mock isc_mem_get failed", + __FILE__, __LINE__); + return (malloc(size)); } @@ -129,8 +129,7 @@ dns_tkeyctx_create_test(void **state) { tctx = NULL; will_return(__wrap_isc__mem_get, false); - assert_int_equal(dns_tkeyctx_create(&mock_mctx, &tctx), - ISC_R_NOMEMORY); + expect_assert_failure(dns_tkeyctx_create(&mock_mctx, &tctx)); tctx = NULL; will_return(__wrap_isc__mem_get, true);