From: sergos via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 1/3] test: fix path storage for non-concatable objects
Date: Mon, 20 Sep 2021 12:37:43 +0300 [thread overview]
Message-ID: <62E85140-FE65-43FC-9F10-9B0611B22F2D@tarantool.org> (raw)
In-Reply-To: <YUhGRDfOuPt98Qhx@root>
[-- Attachment #1: Type: text/plain, Size: 2367 bytes --]
Thanks for explanation!
LGTM.
Sergos
> On 20 Sep 2021, at 11:28, Sergey Kaplun <skaplun@tarantool.org> wrote:
>
> Hi, Sergos!
>
> Thanks for the review!
>
> On 15.09.21, sergos wrote:
>> Hi!
>> Thanks for the patch!
>>
>>> On 9 Sep 2021, at 10:03, Sergey Kaplun <skaplun@tarantool.org <mailto:skaplun@tarantool.org>> wrote:
>>>
>>> When the key of a table to compare via `tap.test:is_deeply()` is
>>> non-concatable object (i.e. lightuserdata) concatenation with path
>> ^^^^ does it mean the object has no __concat, while has __tostring?
>>
>> As a result: is there a case an object has no __tostring?
>
> Yes, for example, userdata may have no neither __tostring, nor __concat
> metamethod, but tostring() will show us its value and prevent raising an
> error.
>
> | luajit -e 'print(getmetatable(newproxy(true)).__tostring, getmetatable(newproxy(true)).__concat); local r = "ud: "..tostring(newproxy()) print(r)'
> | nil nil
> | ud: userdata: 0x41edce48
>
>>
>>> raises an error.
>>>
>>> This patch converts object to string to avoid this error.
>>>
>>> Needed for tarantool/tarantool#5629
>>> ---
>>> test/tarantool-tests/tap.lua | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/test/tarantool-tests/tap.lua b/test/tarantool-tests/tap.lua
>>> index 44fcac3d..a1f54d20 100644
>>> --- a/test/tarantool-tests/tap.lua
>>> +++ b/test/tarantool-tests/tap.lua
>>> @@ -166,7 +166,7 @@ local function is_deeply(test, got, expected, message, extra)
>>>
>>> for k, v in pairs(got) do
>>> has[k] = true
>>> - extra.path = path .. "." .. k
>>> + extra.path = path .. "." .. tostring(k)
>>> if not cmpdeeply(v, expected[k], extra) then
>>> return false
>>> end
>>> @@ -175,7 +175,7 @@ local function is_deeply(test, got, expected, message, extra)
>>> -- Check if expected contains more keys then got.
>>> for k, v in pairs(expected) do
>>> if has[k] ~= true and (extra.strict or v ~= NULL) then
>>> - extra.path = path .. "." .. k
>>> + extra.path = path .. "." .. tostring(k)
>>> extra.expected = "key (exists): " .. tostring(k)
>>> extra.got = "key (missing): " .. tostring(k)
>>> return false
>>> --
>>> 2.31.0
>>>
>>
>
> --
> Best regards,
> Sergey Kaplun
[-- Attachment #2: Type: text/html, Size: 15076 bytes --]
next prev parent reply other threads:[~2021-09-20 9:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 7:03 [Tarantool-patches] [PATCH luajit 0/3] Follow-up fixes for full 64-bit lightuserdata interning Sergey Kaplun via Tarantool-patches
2021-09-09 7:03 ` [Tarantool-patches] [PATCH luajit 1/3] test: fix path storage for non-concatable objects Sergey Kaplun via Tarantool-patches
2021-09-15 15:30 ` sergos via Tarantool-patches
2021-09-20 8:28 ` Sergey Kaplun via Tarantool-patches
2021-09-20 9:37 ` sergos via Tarantool-patches [this message]
2022-06-28 15:41 ` Igor Munkin via Tarantool-patches
2021-09-09 7:03 ` [Tarantool-patches] [PATCH luajit 2/3] Reorganize lightuserdata interning code Sergey Kaplun via Tarantool-patches
2021-09-15 15:30 ` sergos via Tarantool-patches
2021-09-20 8:32 ` Sergey Kaplun via Tarantool-patches
2021-09-20 9:37 ` sergos via Tarantool-patches
2022-06-28 15:42 ` Igor Munkin via Tarantool-patches
2021-09-09 7:03 ` [Tarantool-patches] [PATCH luajit 3/3] Avoid conflict between 64 bit lightuserdata and ITERN key Sergey Kaplun via Tarantool-patches
2021-09-15 15:31 ` sergos via Tarantool-patches
2021-09-20 8:38 ` Sergey Kaplun via Tarantool-patches
2021-09-20 9:37 ` sergos via Tarantool-patches
2022-06-29 20:20 ` Igor Munkin via Tarantool-patches
2022-06-30 12:11 ` [Tarantool-patches] [PATCH luajit 0/3] Follow-up fixes for full 64-bit lightuserdata interning Igor Munkin via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=62E85140-FE65-43FC-9F10-9B0611B22F2D@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=sergos@tarantool.org \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit 1/3] test: fix path storage for non-concatable objects' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox