Improve error reporting.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user