mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
mg_get_var unit test
This commit is contained in:
@@ -266,18 +266,20 @@ START_TEST(test_mg_get_var)
|
|||||||
ck_assert_int_eq(ret, 10);
|
ck_assert_int_eq(ret, 10);
|
||||||
ck_assert_str_eq("that is it", buf);
|
ck_assert_str_eq("that is it", buf);
|
||||||
|
|
||||||
/* key without value in the middle of a longer string */
|
/* key with = but without value in the middle of a longer string */
|
||||||
memset(buf, 77, sizeof(buf));
|
memset(buf, 77, sizeof(buf));
|
||||||
ret =
|
ret =
|
||||||
mg_get_var2(longquery, strlen(longquery), "key5", buf, sizeof(buf), 0);
|
mg_get_var2(longquery, strlen(longquery), "key5", buf, sizeof(buf), 0);
|
||||||
ck_assert_int_eq(ret, 0);
|
ck_assert_int_eq(ret, 0);
|
||||||
ck_assert_str_eq(buf, "");
|
ck_assert_str_eq(buf, "");
|
||||||
|
|
||||||
|
/* key without = and without value in the middle of a longer string */
|
||||||
memset(buf, 77, sizeof(buf));
|
memset(buf, 77, sizeof(buf));
|
||||||
ret =
|
ret =
|
||||||
mg_get_var2(longquery, strlen(longquery), "key6", buf, sizeof(buf), 0);
|
mg_get_var2(longquery, strlen(longquery), "key6", buf, sizeof(buf), 0);
|
||||||
ck_assert_int_eq(ret, 0);
|
ck_assert_int_eq(ret, -1);
|
||||||
ck_assert_str_eq(buf, "");
|
ck_assert_str_eq(buf, "");
|
||||||
|
/* TODO: this is the same situation as with mg_get_value */
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user