mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
parse_array: Use parsebuffer
This commit is contained in:
@ -46,13 +46,23 @@ static void assert_is_array(cJSON *array_item)
|
||||
|
||||
static void assert_not_array(const char *json)
|
||||
{
|
||||
TEST_ASSERT_NULL(parse_array(item, (const unsigned char*)json, &error_pointer, &global_hooks));
|
||||
parse_buffer buffer;
|
||||
buffer.content = (const unsigned char*)json;
|
||||
buffer.length = strlen(json) + sizeof("");
|
||||
buffer.offset = 0;
|
||||
|
||||
TEST_ASSERT_NULL(parse_array(item, &buffer, &error_pointer, &global_hooks));
|
||||
assert_is_invalid(item);
|
||||
}
|
||||
|
||||
static void assert_parse_array(const char *json)
|
||||
{
|
||||
TEST_ASSERT_NOT_NULL(parse_array(item, (const unsigned char*)json, &error_pointer, &global_hooks));
|
||||
parse_buffer buffer;
|
||||
buffer.content = (const unsigned char*)json;
|
||||
buffer.length = strlen(json) + sizeof("");
|
||||
buffer.offset = 0;
|
||||
|
||||
TEST_ASSERT_NOT_NULL(parse_array(item, &buffer, &error_pointer, &global_hooks));
|
||||
assert_is_array(item);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user