Skip to content

Commit

Permalink
chore(test): add failing test for callable
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Nov 5, 2024
1 parent f3d8e99 commit 599d657
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test-types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ asserteq(types.is_integer(-10.1),false)

asserteq(types.is_callable(asserteq),true)
asserteq(types.is_callable(List),true)
do
local mt = setmetatable({}, {
__index = {
__call = function() end
}
})
asserteq(type(mt.__call), "function") -- __call is looked-up through another metatable
local nc = setmetatable({}, mt)
asserteq(types.is_callable(nc), false) -- NOT callable, since __call is fetched using RAWget by Lua
end

asserteq(types.is_indexable(array),true)
asserteq(types.is_indexable('hello'),nil)
Expand Down

0 comments on commit 599d657

Please sign in to comment.