[Tarantool-patches] [PATCH luajit v3 11/29] test: adapt PUC-Rio test for debug in vararg func

Sergey Kaplun skaplun at tarantool.org
Tue Apr 13 16:27:11 MSK 2021


Lua 5.1 interprets `...` in the vararg functions as an additional
local argument unlike LuaJIT does. So, `a:f()` function will not set
the corresponding table `arg`, as test expects.

Implicit `arg` parameter for old-style vararg functions was finally
removed in Lua 5.2. The test is adapted from PUC-Rio Lua 5.2 test suite
by removing additional check for amount of arguments via `arg.n`.
Lua 5.2 test suite is taken from
https://www.lua.org/tests/lua-5.2.0-tests.tar.gz.

Resolves tarantool/tarantool#5694
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
 test/PUC-Rio-Lua-5.1-tests/db.lua | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
index 82d1cfa6..6c412170 100644
--- a/test/PUC-Rio-Lua-5.1-tests/db.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
@@ -303,7 +303,16 @@ debug.sethook(function (e)
 end, "c")
 
 a:f(1,2,3,4,5)
-assert(X.self == a and X.a == 1   and X.b == 2 and X.arg.n == 3 and X.c == nil)
+
+-- LuaJIT: Lua 5.1 interprets `...` in the vararg functions as
+-- an additional local argument unlike LuaJIT does.
+-- So, `a:f()` function will not set the corresponding table
+-- `arg`, as test expects.
+-- Implicit `arg` parameter for old-style vararg functions was
+-- finally removed in Lua 5.2
+-- The test is adapted from PUC-Rio Lua 5.2 test suite by removing
+-- additional `arg.n == 3` check.
+assert(X.self == a and X.a == 1   and X.b == 2 and X.c == nil)
 assert(XX == 12)
 assert(debug.gethook() == nil)
 
-- 
2.31.0



More information about the Tarantool-patches mailing list