MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / test_resp3_push_options

Function test_resp3_push_options

deps/hiredis/test.c:792–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

790}
791
792static 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
831void free_privdata(void *privdata) {
832 struct privdata *data = privdata;

Callers 1

test_blocking_connectionFunction · 0.85

Calls 5

get_redis_tcp_optionsFunction · 0.85
redisConnectWithOptionsFunction · 0.85
redisFreeFunction · 0.85
redisAsyncFreeFunction · 0.85

Tested by

no test coverage detected