mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Added tester.test.error() to tester.lua script
This commit is contained in:
parent
fbb5cbac1a
commit
abdfd78354
@ -128,6 +128,18 @@ function tester.test.equal(result, expected)
|
||||
end
|
||||
|
||||
|
||||
function tester.test.error(fn, ...)
|
||||
local passed = not pcall(fn, ...)
|
||||
local info = debug.getinfo(2)
|
||||
if passed then
|
||||
dopass(info.short_src, info.currentline)
|
||||
else
|
||||
dofail(info.short_src, info.currentline)
|
||||
printfailmsg("Expected an error to be raised")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function tester.dotests(t)
|
||||
local keys = {}
|
||||
for k in pairs(t) do table.insert(keys, k) end
|
||||
|
Loading…
Reference in New Issue
Block a user