提交 bc0bb7c2 编写于 作者: M Max Bruckner

parse_with_opts: test return_parse_end

上级 56a32f9e
...@@ -58,6 +58,17 @@ static void parse_with_opts_should_require_null_if_requested(void) ...@@ -58,6 +58,17 @@ static void parse_with_opts_should_require_null_if_requested(void)
TEST_ASSERT_NULL(cJSON_ParseWithOpts("{}x", NULL, true)); TEST_ASSERT_NULL(cJSON_ParseWithOpts("{}x", NULL, true));
} }
static void parse_with_opts_should_return_parse_end(void)
{
const char json[] = "[] empty array XD";
const char *parse_end = NULL;
cJSON *item = cJSON_ParseWithOpts(json, &parse_end, false);
TEST_ASSERT_NOT_NULL(item);
TEST_ASSERT_EQUAL_INT(2, parse_end - json);
cJSON_Delete(item);
}
int main(void) int main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();
...@@ -65,6 +76,7 @@ int main(void) ...@@ -65,6 +76,7 @@ int main(void)
RUN_TEST(parse_with_opts_should_handle_null); RUN_TEST(parse_with_opts_should_handle_null);
RUN_TEST(parse_with_opts_should_handle_empty_strings); RUN_TEST(parse_with_opts_should_handle_empty_strings);
RUN_TEST(parse_with_opts_should_require_null_if_requested); RUN_TEST(parse_with_opts_should_require_null_if_requested);
RUN_TEST(parse_with_opts_should_return_parse_end);
return UNITY_END(); return UNITY_END();
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册