]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Adjust tkey_test.c test to mock_assert() when there's no memory
authorOndřej Surý <ondrej@sury.org>
Tue, 23 Jul 2019 15:55:19 +0000 (11:55 -0400)
committerOndřej Surý <ondrej@sury.org>
Tue, 23 Jul 2019 19:32:36 +0000 (15:32 -0400)
lib/dns/tests/tkey_test.c

index 805258ad0daac9140f9a01ace75c5308745af07d..8727f1eddd3503e65cfee23049a443c33aaad9bf 100644 (file)
@@ -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);