[Tarantool-patches] [PATCH v2 luajit 05/30] test: adapt arg availability test from Lua suite

Sergey Ostanevich sergos at tarantool.org
Fri Mar 26 14:22:58 MSK 2021


LGTM.

Although, I can’t support the `s = string.gsub(s, "lua", progname, 1)`
technique. 

Sergos

> On 26 Mar 2021, at 10:42, Sergey Kaplun <skaplun at tarantool.org> wrote:
> 
> 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.
> 
> Closes tarantool/tarantool#5686
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
> ---
> test/PUC-Lua-5.1-tests/main.lua | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/test/PUC-Lua-5.1-tests/main.lua b/test/PUC-Lua-5.1-tests/main.lua
> index 4f8b8bf..c11a576 100644
> --- a/test/PUC-Lua-5.1-tests/main.lua
> +++ b/test/PUC-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
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20210326/13ac86f4/attachment.htm>


More information about the Tarantool-patches mailing list