get rid of dubious heuristic helper
When we run into errors that aren't just assertion failures we should just be able to look at the entire call stack.
This commit is contained in:
parent
38bcc28be6
commit
5017c41540
12
app.lua
12
app.lua
|
@ -69,7 +69,7 @@ function love.run()
|
|||
|
||||
-- Tests always run at the start.
|
||||
Test_errors = {}
|
||||
App.run_tests(record_error_with_heuristic_location)
|
||||
App.run_tests(record_error)
|
||||
-- example handler
|
||||
if #Test_errors > 0 then
|
||||
error('There were test failures:\n\n'..table.concat(Test_errors, '\n'))
|
||||
|
@ -452,16 +452,6 @@ function record_error(test_name, err)
|
|||
table.insert(Test_errors, test_name..' -- '..err_without_line_number)
|
||||
end
|
||||
|
||||
-- Test_errors will be an array
|
||||
-- add test_name and guess at file/line
|
||||
function record_error_with_heuristic_location(test_name, err)
|
||||
local err_without_line_number = err:gsub('^[^:]*:[^:]*: ', '')
|
||||
local stack_trace = debug.traceback('', --[[stack frame]]5)
|
||||
local file_and_line_number = stack_trace:gsub('stack traceback:\n', ''):gsub(': .*', '') --[[strip newline and tab]] :sub(3)
|
||||
local full_error = test_name..' -- '..err_without_line_number..' ('..file_and_line_number..')'
|
||||
table.insert(Test_errors, full_error)
|
||||
end
|
||||
|
||||
-- Test_errors will be a table by test name
|
||||
function record_error_by_test(test_name, err)
|
||||
local err_without_line_number = err:gsub('^[^:]*:[^:]*: ', '')
|
||||
|
|
Loading…
Reference in New Issue