From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B544329D90 for ; Mon, 10 Sep 2018 09:12:21 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MX41hkuWo1Zy for ; Mon, 10 Sep 2018 09:12:21 -0400 (EDT) Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [94.100.177.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id ED6E329C87 for ; Mon, 10 Sep 2018 09:12:20 -0400 (EDT) Date: Mon, 10 Sep 2018 16:12:20 +0300 From: Alexander Turenko Subject: [tarantool-patches] Re: [PATCH v3] json: add options to json.encode() Message-ID: <20180910131220.sdbvfye7h2svl4z6@tkn_work_nb> References: <28658371533050946@myt4-74a8acfc13eb.qloud-c.yandex.net> <898281533156060@myt5-cf6d29327892.qloud-c.yandex.net> <26831531533678724@myt5-f9d71769b752.qloud-c.yandex.net> <6304221534202083@iva8-37fc2ad204cd.qloud-c.yandex.net> <20180909152804.4lagt5drkymriv5x@tkn_work_nb> <31669101536536574@iva1-77b79d681cd9.qloud-c.yandex.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <31669101536536574@iva1-77b79d681cd9.qloud-c.yandex.net> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Roman Khabibov , Kirill Yukhin Cc: Vladislav Shpilevoy , tarantool-patches@freelists.org 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@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.