|
|
@ -243,7 +243,7 @@ local function load_tests(file, tests)
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
else
|
|
|
|
dfhack.internal.IN_TEST = true
|
|
|
|
dfhack.internal.IN_TEST = true
|
|
|
|
local ok, err = pcall(code)
|
|
|
|
local ok, err = dfhack.pcall(code)
|
|
|
|
dfhack.internal.IN_TEST = false
|
|
|
|
dfhack.internal.IN_TEST = false
|
|
|
|
if not ok then
|
|
|
|
if not ok then
|
|
|
|
dfhack.printerr('Error when running file: ' .. tostring(err))
|
|
|
|
dfhack.printerr('Error when running file: ' .. tostring(err))
|
|
|
@ -296,7 +296,7 @@ local function wrap_test(func)
|
|
|
|
{dfhack, 'reqscript', clean_reqscript},
|
|
|
|
{dfhack, 'reqscript', clean_reqscript},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function()
|
|
|
|
function()
|
|
|
|
local ok, err = pcall(func)
|
|
|
|
local ok, err = dfhack.pcall(func)
|
|
|
|
if printerr_called then
|
|
|
|
if printerr_called then
|
|
|
|
return false,
|
|
|
|
return false,
|
|
|
|
"dfhack.printerr was called outside of" ..
|
|
|
|
"dfhack.printerr was called outside of" ..
|
|
|
@ -317,7 +317,8 @@ local function run_test(test, status, counts)
|
|
|
|
dfhack.internal.IN_TEST = false
|
|
|
|
dfhack.internal.IN_TEST = false
|
|
|
|
local passed = false
|
|
|
|
local passed = false
|
|
|
|
if not ok then
|
|
|
|
if not ok then
|
|
|
|
dfhack.printerr('test errored: ' .. test.name .. ': ' .. tostring(err))
|
|
|
|
dfhack.printerr('error: ' .. tostring(err) .. '\n')
|
|
|
|
|
|
|
|
dfhack.printerr('test errored: ' .. test.name)
|
|
|
|
elseif test.private.checks ~= test.private.checks_ok then
|
|
|
|
elseif test.private.checks ~= test.private.checks_ok then
|
|
|
|
dfhack.printerr('test failed: ' .. test.name)
|
|
|
|
dfhack.printerr('test failed: ' .. test.name)
|
|
|
|
else
|
|
|
|
else
|
|
|
|