[tarantool-patches] Re: [PATCH v3] json: add options to json.encode()
Alexander Turenko
alexander.turenko at tarantool.org
Mon Sep 10 16:12:20 MSK 2018
The patch looks good for me.
One minor comment is below.
Kirill, can you look into the patch? Two review iterations were passed.
branch: romankhabibov/gh-2888-options-encode
issue: https://github.com/tarantool/tarantool/issues/2888
WBR, Alexander Turenko.
On Mon, Sep 10, 2018 at 02:42:54AM +0300, roman.habibov1 at yandex.ru wrote:
> Hi! Thanks for review.
>
> --
> + -- gh-2888: Check the possibility of using options in encode()/decode().
> + --
> + local orig_encode_max_depth = serializer.cfg.encode_max_depth
> + local sub = {a = 1, { b = {c = 1, d = {e = 1}}}}
> + serializer.cfg({encode_max_depth = 1})
> + test:ok(serializer.encode(sub) == '{"1":null,"a":1}',
> + 'depth of encoding is 1 with .cfg')
> + serializer.cfg({encode_max_depth = orig_encode_max_depth})
> + test:ok(serializer.encode(sub, {encode_max_depth = 1}) == '{"1":null,"a":1}',
> + 'depth of encoding is 1 with .encode')
test:ok(got == exp, msg) can be replaced with test:is(got, exp, msg) and
will show what was expected and what was got in case of fail.
More information about the Tarantool-patches
mailing list