diff --git a/tests/test-types.lua b/tests/test-types.lua index df2566c0..7cf313de 100644 --- a/tests/test-types.lua +++ b/tests/test-types.lua @@ -35,11 +35,16 @@ asserteq(types.is_callable(List),true) do local mt = setmetatable({}, { __index = { - __call = function() end + __call = function() return "ok" end } }) asserteq(type(mt.__call), "function") -- __call is looked-up through another metatable local nc = setmetatable({}, mt) + -- proof-of-pudding, let's call it. To verify Lua behaves the same on all engines + local success, result = pcall(function() return nc() end) + assert(result ~= "ok", "expected result to not be 'ok'") + asserteq(success, false) + -- real test now asserteq(types.is_callable(nc), false) -- NOT callable, since __call is fetched using RAWget by Lua end