1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
local getTrace = function(filename, info)
local index = info.traceback:find('\n%s*%[C]')
info.traceback = info.traceback:sub(1, index)
return info
end
return function(busted)
local loadCurrentFile = function(info, options)
local filename = 'string'
if info.source:sub(1,1) == '@' or info.source:sub(1,1) == '=' then
filename = info.source:sub(2)
end
-- Setup test file to be compatible with live coding
if info.func then
local file = setmetatable({
getTrace = getTrace,
rewriteMessage = nil
}, {
__call = info.func
})
busted.executors.file(filename, file)
end
end
return loadCurrentFile
end
|