Files
testium/test/validation/items/lua_func/lua_func.lua
François 6f832cd67b validation: cover nil/None return from lua_func/py_func
Two new steps per language: function returning nothing and function
returning explicit nil/None. Both tagged $(test)_PASS — they would
have failed before the lua nil fix (Lua side reported nil result as
error). Python side already worked but is covered for parity.
2026-05-17 18:13:03 +02:00

60 lines
1.1 KiB
Lua

tm = require("tm")
local module = {}
function module.donothing(param)
return 0
end
function module.assertparam(param)
assert(param)
return 0
end
function module.checkglobal(param)
local res = tm.gd(param)
return res
end
function module.checkglobal2(index)
return tm.gd("lua_data_to_be_returned")[index]
end
function module.should_not_be_called(param)
assert(false)
end
function module.echo(param)
return param
end
function module.tuple_return(first, second)
return first, second
end
function module.set_context_value(val)
tm.setgd("_lua_ctx_test_value", val)
return val
end
function module.get_context_value()
return tm.gd("_lua_ctx_test_value")
end
function module.test_delgd()
tm.setgd("_lua_delgd_test", 42)
assert(tm.gd("_lua_delgd_test") == 42)
tm.delgd("_lua_delgd_test")
assert(tm.gd("_lua_delgd_test", "__deleted__") == "__deleted__")
return 0
end
function module.return_nothing()
-- Returns no value: ret is nil but no error.
end
function module.return_explicit_nil()
return nil
end
return module