[Tarantool-patches] [PATCH v2 luajit 22/30] test: disable PUC Lua test for var names in error

Sergey Kaplun skaplun at tarantool.org
Fri Mar 26 10:43:05 MSK 2021


LuaJIT includes variable name to the error report, when try to
call non-function object without __call methamethod.
Also, LuaJIT includes variable name to the error report, when try to
perform unacceptable arifmetic operation with the variable.
Lua 5.1 doesn't report variable name in these errors.

Test ckecked that variable name aren't reported are disabled by
this patch.

Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
 test/PUC-Lua-5.1-tests/errors.lua | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/PUC-Lua-5.1-tests/errors.lua b/test/PUC-Lua-5.1-tests/errors.lua
index e881211..cf24e40 100644
--- a/test/PUC-Lua-5.1-tests/errors.lua
+++ b/test/PUC-Lua-5.1-tests/errors.lua
@@ -72,8 +72,13 @@ checkmessage("b=1; local aaa='a'; x=aaa+b", "local 'aaa'")
 checkmessage("aaa={}; x=3/aaa", "global 'aaa'")
 checkmessage("aaa='2'; b=nil;x=aaa*b", "global 'b'")
 checkmessage("aaa={}; x=-aaa", "global 'aaa'")
-assert(not string.find(doit"aaa={}; x=(aaa or aaa)+(aaa and aaa)", "'aaa'"))
-assert(not string.find(doit"aaa={}; (aaa or aaa)()", "'aaa'"))
+-- LuaJIT: LuaJIT includes variable name to the error report.
+-- It looks like:
+-- "attempt to perform arithmetic on global 'aaa' (a table value)"
+-- Lua 5.1 doesn't report variable name here.
+-- Tests are disabled for LuaJIT.
+-- assert(not string.find(doit"aaa={}; x=(aaa or aaa)+(aaa and aaa)", "'aaa'"))
+-- assert(not string.find(doit"aaa={}; (aaa or aaa)()", "'aaa'"))
 
 checkmessage([[aaa=9
 repeat until 3==3
-- 
2.31.0



More information about the Tarantool-patches mailing list