From b335a42d19cd6a421cc120e9ed7c23869bdbfc7e Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 25 Jul 2015 19:15:07 +0200 Subject: [PATCH] mg_get_var unit test --- test/public.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/public.c b/test/public.c index de575a3d..819b1a3c 100644 --- a/test/public.c +++ b/test/public.c @@ -270,10 +270,14 @@ START_TEST(test_mg_get_var) memset(buf, 77, sizeof(buf)); ret = mg_get_var2(longquery, strlen(longquery), "key5", buf, sizeof(buf), 0); - ck_assert_int_eq(ret, -1); - /* TODO: we can not distinguish between "key not found" and "key has no - * value" - * -> this is a problem in the API */ + ck_assert_int_eq(ret, 0); + ck_assert_str_eq(buf, ""); + + memset(buf, 77, sizeof(buf)); + ret = + mg_get_var2(longquery, strlen(longquery), "key6", buf, sizeof(buf), 0); + ck_assert_int_eq(ret, 0); + ck_assert_str_eq(buf, ""); } END_TEST