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

Sergey Kaplun skaplun at tarantool.org
Thu Sep 9 10:03:17 MSK 2021


When the key of a table to compare via `tap.test:is_deeply()` is
non-concatable object (i.e. lightuserdata) concatenation with path
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