Add xpcall.

This commit is contained in:
James Roseborough
2008-07-22 01:20:25 +00:00
parent 80d8fccd1a
commit 289a0df9f5
2 changed files with 53 additions and 31 deletions

View File

@@ -12,7 +12,7 @@ checkallerrors('assert',{{nil,false},{'message'}},'message')
-- collectgarbage
banner('collectgarbage')
checkallpass('collectgarbage',{{'collect','count'}})
checkallpass('collectgarbage',{{'collect','count'}},true)
checkallerrors('collectgarbage',{notanil},'bad argument #1')
-- dofile
@@ -132,8 +132,10 @@ checkallerrors('tonumber',{somenumber,{1,37,atable,afunction,aboolean}},'bad arg
-- tostring
banner('tostring')
checkallpass('tostring',{notanil})
checkallpass('tostring',{anylua,{'anchor'}})
checkallpass('tostring',{{astring,anumber,aboolean}})
checkallpass('tostring',{{atable,afunction,athread}},true)
checkallpass('tostring',{{astring,anumber,aboolean},{'anchor'}})
checkallpass('tostring',{{atable,afunction,athread},{'anchor'}},true)
checkallerrors('tostring',{},'bad argument #1')
-- type
@@ -153,7 +155,8 @@ checkallerrors('unpack',{sometable,somenumber,nonnumber},'bad argument #3')
-- xpcall
banner('xpcall')
checkallpass('xpcall', {notanil,notanil})
checkallpass('xpcall', {notanil,nonfunction})
checkallpass('xpcall', {notanil,{function(...)return 'aaa', 'bbb', #{...} end}})
checkallerrors('xpcall',{anylua},'bad argument #2')