|
|
@ -206,6 +206,7 @@ function save_test_status(status)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function finish_tests()
|
|
|
|
function finish_tests()
|
|
|
|
|
|
|
|
dfhack.internal.IN_TEST = false
|
|
|
|
if done_command then
|
|
|
|
if done_command then
|
|
|
|
dfhack.run_command(done_command)
|
|
|
|
dfhack.run_command(done_command)
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -220,7 +221,9 @@ function load_tests(file, tests)
|
|
|
|
dfhack.printerr('Failed to load file: ' .. tostring(err))
|
|
|
|
dfhack.printerr('Failed to load file: ' .. tostring(err))
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
dfhack.internal.IN_TEST = true
|
|
|
|
local ok, err = pcall(code)
|
|
|
|
local ok, err = pcall(code)
|
|
|
|
|
|
|
|
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))
|
|
|
|
return false
|
|
|
|
return false
|
|
|
@ -260,7 +263,9 @@ function run_test(test, status, counts)
|
|
|
|
test.private.checks = 0
|
|
|
|
test.private.checks = 0
|
|
|
|
test.private.checks_ok = 0
|
|
|
|
test.private.checks_ok = 0
|
|
|
|
counts.tests = counts.tests + 1
|
|
|
|
counts.tests = counts.tests + 1
|
|
|
|
|
|
|
|
dfhack.internal.IN_TEST = true
|
|
|
|
local ok, err = pcall(test.func)
|
|
|
|
local ok, err = pcall(test.func)
|
|
|
|
|
|
|
|
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('test errored: ' .. test.name .. ': ' .. tostring(err))
|
|
|
|