[Tarantool-patches] [PATCH luajit v3 05/29] test: adapt PUC-Rio test for arg presence

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


The argument table `arg` can be read (and modified) by `LUA_INIT` and
`-e` chunks since the commit 92d9ff211ae864777a8580b5a7326d5f408161ce
(Set arg table before evaluating LUA_INIT and -e chunks.).

This behaviour is similar to Lua 5.3, so the test was adapted
considering PUC-Rio Lua 5.3 test suite taken from
https://www.lua.org/tests/lua-5.3.0-tests.tar.gz.

Resolves tarantool/tarantool#5686
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
 test/PUC-Rio-Lua-5.1-tests/main.lua | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/test/PUC-Rio-Lua-5.1-tests/main.lua b/test/PUC-Rio-Lua-5.1-tests/main.lua
index e72b1896..606ebacc 100644
--- a/test/PUC-Rio-Lua-5.1-tests/main.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/main.lua
@@ -69,9 +69,19 @@ a = string.format(a, progname)
 prepfile(a)
 RUN('lua "-e " -- %s a b c', prog)
 
-prepfile"assert(arg==nil)"
+-- test 'arg' availability in libraries
+-- LuaJIT: LuaJIT v2.1.0-beta3 has extension from Lua 5.3:
+-- The argument table `arg` can be read (and modified)
+-- by `LUA_INIT` and `-e` chunks.
+-- See commit 92d9ff211ae864777a8580b5a7326d5f408161ce
+-- (Set arg table before evaluating LUA_INIT and -e chunks.).
+-- See also https://github.com/tarantool/tarantool/issues/5686.
+-- In Lua 5.3 this feature was introduced via commit
+-- 23f0ff95177eda2e0a80e3a48562cc6837705735.
+-- Test is adapted from PUC-Rio Lua 5.3 test suite.
+prepfile"assert(arg)"
 prepfile("assert(arg)", otherprog)
-RUN("lua -l%s - < %s", prog, otherprog)
+RUN('env LUA_PATH="?;;" lua -l%s - < %s', prog, otherprog)
 
 prepfile""
 RUN("lua - < %s > %s", prog, out)
-- 
2.31.0



More information about the Tarantool-patches mailing list