Add argument type check tests for basic library

This commit is contained in:
James Roseborough
2008-07-15 21:51:42 +00:00
parent 33eca97351
commit bc279c7a9b
2 changed files with 89 additions and 17 deletions

View File

@@ -1,10 +1,12 @@
-- utilities to check that args of various types pass or fail
-- argument type checking
akey = 'aa'
astring = 'abc'
astrnum = '789'
anumber = 1.23
aboolean = true
atable = {aa=11,bb=22}
atable = {[akey]=456}
afunction = function() end
anil = nil
@@ -12,11 +14,13 @@ anylua = { anil, astring, anumber, aboolean, atable, afunction }
somestring = { astring }
somenumber = { anumber }
somestrnum = { astring, anumber }
somestrnum = { anumber, astrnum }
someboolean = { aboolean }
sometable = { atable }
somefunction = { afunction }
somenil = { anil }
somekey = { akey }
notakey = { astring, anumber, aboolean, atable, afunction }
local function contains(set,val)
local m = #set
@@ -180,18 +184,6 @@ function checkallfail( name, typesets )
end
end
function checkfail( name, ... )
subbanner('checkfail')
local v = {...}
local sig = signature(name,v)
local s,e = invoke( name, v )
if not s then
print( ok, sig )
else
print( needcheck, sig, e )
end
end
-- check that all combinations of arguments fail in some way,
-- ignore error messages
function checkallerrors( name, typesets, template )