git.m455.casa

fa

clone url: git://git.m455.casa/fa


esperbuild/espersrc/fennel-0.7.0/test/init.lua

1 -- Ensure we're getting the Fennel we expect, not luarocks or anything
2 package.loaded.fennel = dofile("fennel.lua")
3 table.insert(package.loaders or package.searchers, package.loaded.fennel.searcher)
4 package.loaded.fennelview = package.loaded.fennel.dofile("fennelview.fnl")
5 package.loaded.fennelfriend = package.loaded.fennel.dofile("src/fennel/friend.fnl")
6
7 local runner = require("test.luaunit").LuaUnit:new()
8 runner:setOutputType(os.getenv("FNL_TEST_OUTPUT") or "tap")
9
10 -- We have to load the tests with the old version of Fennel; otherwise
11 -- bugs in the current implementation will prevent the tests from loading!
12 local oldfennel = dofile("old/fennel.lua")
13
14 local function testall(suites)
15 local instances = {}
16 for _, test in ipairs(suites) do
17 -- attach test modules (which export k/v tables of test fns) as alists
18 local suite = oldfennel.dofile("test/" .. test .. ".fnl")
19 for name, testfn in pairs(suite) do
20 table.insert(instances, {name,testfn})
21 end
22 end
23 return runner:runSuiteByInstances(instances)
24 end
25
26 if(#arg == 0) then
27 testall({"core", "mangling", "quoting", "misc", "docstring", "fennelview",
28 "failures", "repl", "cli", "macro", "linter"})
29 else
30 testall(arg)
31 end
32
33 os.exit(runner.result.notSuccessCount == 0 and 0 or 1)