diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 8 | ||||
| -rw-r--r-- | tests/runner.lua | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/run.lua b/tests/run.lua index 283551ed7..f56933f3b 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -3,8 +3,8 @@ import("core.base.task") import("core.base.option") import("runner", {rootdir = os.scriptdir()}) -function _run_test(script) - runner(script) +function _run_test(script, opt) + runner(script, opt) end -- run test with the given name @@ -38,8 +38,8 @@ function _run_test_filter(name) cprint("> %s", v) end end - for _, v in ipairs(tests) do - _run_test(v) + for i, v in ipairs(tests) do + _run_test(v, {index = i, total = #tests}) end cprint("> %d test(s) succeed", #tests) end diff --git a/tests/runner.lua b/tests/runner.lua index b3d578a6f..5b8b0f5f5 100644 --- a/tests/runner.lua +++ b/tests/runner.lua @@ -1,7 +1,8 @@ import("core.base.option") import("test_utils.context", { alias = "test_context" }) -function main(script) +function main(script, opt) + opt = opt or {} if os.isdir(script) then script = path.join(script, "test.lua") @@ -21,7 +22,7 @@ function main(script) local verbose = option.get("verbose") or option.get("diagnosis") -- trace - cprint(">> testing %s ...", path.relative(root)) + cprint(">> [%d/%d]: testing %s ...", opt.index, opt.total, path.relative(root)) -- get test functions local data = import("test", { rootdir = root, anonymous = true }) |
