| 630 | } |
| 631 | |
| 632 | static void test_allocator_injection(void) { |
| 633 | hiredisAllocFuncs ha = { |
| 634 | .mallocFn = hi_malloc_fail, |
| 635 | .callocFn = hi_calloc_fail, |
| 636 | .reallocFn = hi_realloc_fail, |
| 637 | .strdupFn = strdup, |
| 638 | .freeFn = free, |
| 639 | }; |
| 640 | |
| 641 | // Override hiredis allocators |
| 642 | hiredisSetAllocators(&ha); |
| 643 | |
| 644 | test("redisContext uses injected allocators: "); |
| 645 | redisContext *c = redisConnect("localhost", 6379); |
| 646 | test_cond(c == NULL); |
| 647 | |
| 648 | test("redisReader uses injected allocators: "); |
| 649 | redisReader *reader = redisReaderCreate(); |
| 650 | test_cond(reader == NULL); |
| 651 | |
| 652 | // Return allocators to default |
| 653 | hiredisResetAllocators(); |
| 654 | } |
| 655 | |
| 656 | #define HIREDIS_BAD_DOMAIN "idontexist-noreally.com" |
| 657 | static void test_blocking_connection_errors(void) { |
no test coverage detected