[Tarantool-patches] [PATCH v2 luajit 11/30] test: adapt getlocal PUC test for vararg func

Sergey Kaplun skaplun at tarantool.org
Fri Mar 26 17:52:50 MSK 2021


Hi, thanks for the review!

I've changed s/first/local/ in the commit message and the comment,
considering your comment for the previous patch.
Also, I've added link to the issue to close.

===================================================================
test: adapt getlocal PUC test for vararg func

Lua 5.1 interprets `...` in the vararg functions like an additional
local argument unlike LuaJIT does. So, `a:f()` function will not set
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 amountt 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.

Closes tarantool/tarantool#5694
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
===================================================================

===================================================================
diff --git a/test/PUC-Lua-5.1-tests/db.lua b/test/PUC-Lua-5.1-tests/db.lua
index 8ea6af7..69e19b6 100644
--- a/test/PUC-Lua-5.1-tests/db.lua
+++ b/test/PUC-Lua-5.1-tests/db.lua
@@ -302,7 +302,7 @@ end, "c")
 a:f(1,2,3,4,5)
 
 -- LuaJIT: Lua 5.1 interprets `...` in the vararg functions like
--- an additional first argument unlike LuaJIT does.
+-- an additional local argument unlike LuaJIT does.
 -- So, `a:f()` function will not set corresponding table `arg`,
 -- as test expects.
 -- Implicit `arg` parameter for old-style vararg functions was
===================================================================

On 26.03.21, Sergey Ostanevich wrote:
> LGTM
> 
> Sergos
> 
> > On 26 Mar 2021, at 10:42, Sergey Kaplun <skaplun at tarantool.org> wrote:
> > 
> > Lua 5.1 interprets `...` in the vararg functions like an additional
> > first argument unlike LuaJIT does. So, `a:f()` function will not set
> > 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 amountt 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.
> > 
> > Part of tarantool/tarantool#5845
> > Part of tarantool/tarantool#4473
> > ---
> > test/PUC-Lua-5.1-tests/db.lua | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/test/PUC-Lua-5.1-tests/db.lua b/test/PUC-Lua-5.1-tests/db.lua
> > index e5d8885..6985c29 100644
> > --- a/test/PUC-Lua-5.1-tests/db.lua
> > +++ b/test/PUC-Lua-5.1-tests/db.lua
> > @@ -300,7 +300,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 like
> > +-- an additional first argument unlike LuaJIT does.
> > +-- So, `a:f()` function will not set 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
> > 
> 

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list