mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +00:00
Added tester.test.error() to tester.lua script
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user