summaryrefslogtreecommitdiff
path: root/tests/runner.lua
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-06-09 11:34:07 +0800
committerOpportunityLiu <[email protected]>2019-06-09 11:34:07 +0800
commitdb9c880b656e33b056bd3e3804eb6009ea946fea (patch)
tree1d5ee9423a1f128bd00085aa6e05441fc4939e20 /tests/runner.lua
parentdca7c26579f7d7857810b58f95e177877f9933fa (diff)
fix
Diffstat (limited to 'tests/runner.lua')
-rw-r--r--tests/runner.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/runner.lua b/tests/runner.lua
index f84b453ba..177bb865a 100644
--- a/tests/runner.lua
+++ b/tests/runner.lua
@@ -9,8 +9,8 @@ function main(script)
script = path.join(script, "test.lua")
end
script = path.absolute(script)
- assert(path.filename(script) == "test.lua")
- assert(os.isfile(script))
+ assert(path.filename(script) == "test.lua", "file should named `test.lua`")
+ assert(os.isfile(script), "should be a file")
-- disable statistics
os.setenv("XMAKE_STATS", "false")
@@ -32,17 +32,17 @@ function main(script)
-- trace
cprint(">> testing %s ...", path.relative(root))
- -- enter script directory
- local old_dir = os.cd(root)
-
-- get test functions
- local data = import("test", { anonymous = true })
+ local data = import("test", { rootdir = root, anonymous = true })
if data.main then
-- ignore everthing when we found a main function
data = { test_main = data.main }
end
+ -- enter script directory
+ local old_dir = os.cd(root)
+
-- run test
local succeed_count = 0
for k, v in pairs(data) do