Improve error reporting.

This commit is contained in:
James Roseborough
2010-05-16 05:09:47 +00:00
parent 3a21941e57
commit fe7658e83b
7 changed files with 51 additions and 55 deletions

View File

@@ -156,7 +156,7 @@ local function subbanner(name)
end
local function pack(s,...)
return s,{...}
return s,arg
end
-- check that all combinations of arguments pass

View File

@@ -61,7 +61,6 @@ banner('loadstring')
checkallpass('loadstring', {{'return'}})
checkallpass('loadstring', {{'return'},{'mychunk'}})
checkallpass('loadstring', {{'return a ... b'},{'mychunk'}},true)
checkallerrors('loadstring', {{'return a ... b'},{'mychunk'}},'hello')
checkallerrors('loadstring', {notastring,{nil,astring,anumber,n=3}}, 'bad argument')
checkallerrors('loadstring', {{'return'},{afunction,atable}}, 'bad argument')
@@ -131,7 +130,7 @@ banner('setmetatable')
checkallpass('setmetatable', {sometable,sometable})
checkallpass('setmetatable', {sometable,{}})
checkallerrors('setmetatable',{notatable,sometable},'bad argument')
checkallerrors('setmetatable',{sometable,notatable},'bad argument')
checkallerrors('setmetatable',{sometable,nontable},'bad argument')
-- tonumber
banner('tonumber')
@@ -157,8 +156,8 @@ checkallerrors('type',{},'bad argument')
-- unpack
banner('unpack')
checkallpass('unpack',{sometable})
checkallpass('unpack',{sometable,somenumber})
checkallpass('unpack',{sometable,somenumber,somenumber})
checkallpass('unpack',{sometable,{3,'5'}})
checkallpass('unpack',{sometable,{3,'5'},{1.25,'7'}})
checkallerrors('unpack',{notatable,somenumber,somenumber},'bad argument')
checkallerrors('unpack',{sometable,nonnumber,somenumber},'bad argument')
checkallerrors('unpack',{sometable,somenumber,nonnumber},'bad argument')