From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [tarantool-patches] Re: [PATCH v2 1/5] lib: introduce json_path_is_multikey helper References: <2ea5cf6ff29e786687e4ddd6110a1cc4ecc6d0a3.1552998554.git.kshcherbatov@tarantool.org> <20190319154324.GE32279@chai> From: Kirill Shcherbatov Message-ID: Date: Tue, 2 Apr 2019 18:49:23 +0300 MIME-Version: 1.0 In-Reply-To: <20190319154324.GE32279@chai> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: tarantool-patches@freelists.org, Konstantin Osipov Cc: vdavydov.dev@gmail.com List-ID: 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.