Add coroutine library argument type check tests.

This commit is contained in:
James Roseborough
2008-07-15 22:13:12 +00:00
parent bc279c7a9b
commit 07b9297adc
2 changed files with 53 additions and 7 deletions

View File

@@ -53,16 +53,19 @@ notatable = except(sometable)
notafunction = except(somefunction)
notanil = except(somenil)
local structtypes = {
['table']='<table>',
['function']='<function>',
['thread']='<thread>',
['userdata']='<userdata>',
}
local function signature(name,arglist)
local t = {}
for i=1,#arglist do
if type(arglist[i]) == 'table' then
t[i] = 'table'
elseif type(arglist[i]) == 'function' then
t[i] = 'function'
else
t[i] = tostring(arglist[i])
end
local ai = arglist[i]
local ti = type(ai)
t[i] = structtypes[ti] or tostring(ai)
end
return name..'('..table.concat(t,',')..')'
end