garden/test.t

30 lines
641 B
Perl

require "boot"
local fennel = require "fennel"
local t = require "faith"
local ffi = require "ffi"
local C = terralib.includecstring([[
#include <sys/types.h>
#include <dirent.h>
]])
local testmodules = {}
if #arg == 0 then
local testdir = C.opendir("test")
local dirent = C.readdir(testdir)
while dirent ~= nil do
local name = ffi.string(dirent.d_name)
local match = name:match("^(.+)%.fnl$")
if match then
table.insert(testmodules, "test." .. match)
end
dirent = C.readdir(testdir)
end
C.closedir(testdir)
else
testmodules = arg
end
t.run(testmodules)