From 5f94f1faa77744cbc55413245ceed7aae96db265 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Wed, 6 Nov 2024 09:18:07 +0100 Subject: [PATCH] verify expected results --- tests/test-types.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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