[tarantool-patches] Re: [PATCH v2 1/5] lib: introduce json_path_is_multikey helper
Kirill Shcherbatov
kshcherbatov at tarantool.org
Tue Apr 2 18:49:23 MSK 2019
Hi! Thank you for participating. We decided to introduce the other
helper json_multikey_path_offset
/**
* Scan the JSON path string and return the offset of the first
* character [*] (the array index placeholder).
* - if [*] is not found, -1 is returned.
* - specified JSON path must be valid
* (may be tested with json_path_validate).
*/
int
json_path_multikey_offset(const char *path, int path_len, int index_base);
> This coverage is insufficient. You should at least test an empty
> path, a path with * in the beginning, middle and end.
I tried to take all the cases into account. In fact, this is not really necessary
because corner cases already well covered by tests (for json_lexer_next_token).
static struct {
const char *str;
int rc;
} test_cases[] = {
{"", -1},
{"[1]Data[1]extra[1]", -1},
{"[*]Data[1]extra[1]", 0},
{"[*]Data[*]extra[1]", 0},
{"[1]Data[*]extra[1]", 7},
{"[1]Data[1]extra[*]", 15},
};
I've resend the whole patchset.
More information about the Tarantool-patches
mailing list