| 790 | } |
| 791 | |
| 792 | static void test_resp3_push_options(struct config config) { |
| 793 | redisAsyncContext *ac; |
| 794 | redisContext *c; |
| 795 | redisOptions options; |
| 796 | |
| 797 | test("We set a default RESP3 handler for redisContext: "); |
| 798 | options = get_redis_tcp_options(config); |
| 799 | assert((c = redisConnectWithOptions(&options)) != NULL); |
| 800 | test_cond(c->push_cb != NULL); |
| 801 | redisFree(c); |
| 802 | |
| 803 | test("We don't set a default RESP3 push handler for redisAsyncContext: "); |
| 804 | options = get_redis_tcp_options(config); |
| 805 | assert((ac = redisAsyncConnectWithOptions(&options)) != NULL); |
| 806 | test_cond(ac->c.push_cb == NULL); |
| 807 | redisAsyncFree(ac); |
| 808 | |
| 809 | test("Our REDIS_OPT_NO_PUSH_AUTOFREE flag works: "); |
| 810 | options = get_redis_tcp_options(config); |
| 811 | options.options |= REDIS_OPT_NO_PUSH_AUTOFREE; |
| 812 | assert((c = redisConnectWithOptions(&options)) != NULL); |
| 813 | test_cond(c->push_cb == NULL); |
| 814 | redisFree(c); |
| 815 | |
| 816 | test("We can use redisOptions to set a custom PUSH handler for redisContext: "); |
| 817 | options = get_redis_tcp_options(config); |
| 818 | options.push_cb = push_handler; |
| 819 | assert((c = redisConnectWithOptions(&options)) != NULL); |
| 820 | test_cond(c->push_cb == push_handler); |
| 821 | redisFree(c); |
| 822 | |
| 823 | test("We can use redisOptions to set a custom PUSH handler for redisAsyncContext: "); |
| 824 | options = get_redis_tcp_options(config); |
| 825 | options.async_push_cb = push_handler_async; |
| 826 | assert((ac = redisAsyncConnectWithOptions(&options)) != NULL); |
| 827 | test_cond(ac->push_cb == push_handler_async); |
| 828 | redisAsyncFree(ac); |
| 829 | } |
| 830 | |
| 831 | void free_privdata(void *privdata) { |
| 832 | struct privdata *data = privdata; |
no test coverage detected