Skip to content

Commit 0c75ce5

Browse files
authored
Merge pull request #44 from daTokenizer/patch-1
add Null reply assertion macro to rm_utils (RMUtil_AssertNullReply)
2 parents f0f9eff + d3ff42f commit 0c75ce5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rmutil/test_util.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
#define RMUtil_Assert(expr) if (!(expr)) { fprintf (stderr, "Assertion '%s' Failed\n", __STRING(expr)); return REDISMODULE_ERR; }
2121

22+
#define RMUtil_AssertNullReply(rep) RMUtil_Assert( \
23+
RedisModule_CallReplyType(rep) == REDISMODULE_REPLY_NULL || RedisModule_CreateStringFromCallReply(rep) == NULL)
24+
2225
#define RMUtil_AssertReplyEquals(rep, cstr) RMUtil_Assert( \
2326
RMUtil_StringEquals(RedisModule_CreateStringFromCallReply(rep), RedisModule_CreateString(ctx, cstr, strlen(cstr))) \
2427
)
@@ -64,4 +67,4 @@ RedisModuleString **RMUtil_MakeArgs(RedisModuleCtx *ctx, int *argcp, const char
6467
return NULL;
6568
}
6669

67-
#endif
70+
#endif

0 commit comments

Comments
 (0)