Aegisub/automation/tests/busted.lua
Thomas Goyne 26361c5003 Add support for using busted 2.0 to run automation tests
Supply a definition of socket.gettime() to remove the dependency on
LuaSocket, as installing binary deps from luarocks doesn't work with a
custom build of luajit.
2015-12-21 19:48:23 -08:00

22 lines
520 B
Lua

local ffi = require("ffi")
ffi.cdef[[
typedef struct timeval {
long tv_sec;
long tv_usec;
} timeval;
int gettimeofday(timeval *t, void *tzp);
]]
-- busted depends on luasocket just for gettime(), so just supply a definition
-- of that to avoid the dep
package.loaded['socket'] = {
gettime = function()
local t = ffi.new("timeval")
ffi.C.gettimeofday(t, nil)
return tonumber(t.tv_sec) + tonumber(t.tv_usec) / 1000000.0
end
}
require 'busted.runner'({ batch = true, standalone = false })