summaryrefslogtreecommitdiffstats
path: root/test/busted/modules/files/lua.lua
blob: a4218f6d45ce45837d0cda3aaeb0c36b894aa165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local path = require 'pl.path'

local ret = {}

local getTrace =  function(filename, info)
  local index = info.traceback:find('\n%s*%[C]')
  info.traceback = info.traceback:sub(1, index)
  return info, false
end

ret.match = function(busted, filename)
  return path.extension(filename) == '.lua'
end


ret.load = function(busted, filename)
  local file, err = loadfile(filename)
  if not file then
    busted.publish({ 'error', 'file' }, { descriptor = 'file', name = filename }, nil, err, {})
  end
  return file, getTrace
end

return ret