blob: faa7755e082d9e3294c3d7cbc90e18a5b4c839e1 (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
-- imports
import("core.project.task")
-- run test with the given name
function _run_test(name)
-- find the test script
for _, script in ipairs(os.files(path.join(os.scriptdir(), "**", name, "test.lua"))) do
-- trace
print("testing %s ...", script)
-- enter script directory
os.cd(path.directory(script))
-- run test
task.run("lua", {script = path.filename(script)})
break
end
end
-- main entry
function main(name)
-- disable statistics
os.setenv("XMAKE_STATS", "false")
-- run the given test
if name then
return _run_test(name)
end
-- run all tests
for _, script in ipairs(os.files(path.join(os.scriptdir(), "**", "test.lua"))) do
-- trace
print("testing %s ...", script)
-- enter script directory
local oldir = os.cd(path.directory(script))
-- run test
task.run("lua", {script = path.filename(script)})
-- leave script directory
os.cd(oldir)
end
end
|