[Tarantool-patches] [PATCH luajit 1/3] test: fix path storage for non-concatable objects

sergos sergos at tarantool.org
Wed Sep 15 18:30:48 MSK 2021


Hi!
Thanks for the patch!

> On 9 Sep 2021, at 10:03, Sergey Kaplun <skaplun at 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?

> 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
> 



More information about the Tarantool-patches mailing list