From 6551d9a4308d0cbec4a2f4c33d28f8bf432bff7f Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 8 Apr 2024 23:49:44 +0800 Subject: improve runner --- tests/runner.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests/runner.lua') diff --git a/tests/runner.lua b/tests/runner.lua index c99142170..4558c38ce 100644 --- a/tests/runner.lua +++ b/tests/runner.lua @@ -50,11 +50,14 @@ function main(script) end, catch { - function (error) - if not error:find("aborting because of ") then - context:print_error(error, v, "unhandled error") + function (errors) + if errors then + error = tostring(errors) + end + if not errors:find("aborting because of ") then + context:print_error(errors, v, "unhandled error") else - raise(error) + raise(errors) end end } -- cgit v1.3.1 From aca3ead5d138db01a4286b410e18f3d85effffe8 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 8 Apr 2024 19:59:11 +0800 Subject: Update runner.lua --- tests/runner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/runner.lua') diff --git a/tests/runner.lua b/tests/runner.lua index 4558c38ce..17783f9e4 100644 --- a/tests/runner.lua +++ b/tests/runner.lua @@ -52,7 +52,7 @@ function main(script) { function (errors) if errors then - error = tostring(errors) + errors = tostring(errors) end if not errors:find("aborting because of ") then context:print_error(errors, v, "unhandled error") -- cgit v1.3.1 From 73abaaf1db8d884ccc1eccff2cef4f17a38fcf72 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 9 Apr 2024 00:43:25 +0800 Subject: fix errors --- tests/run.lua | 5 ----- tests/runner.lua | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'tests/runner.lua') diff --git a/tests/run.lua b/tests/run.lua index 00c18ff07..ff6158ab2 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -16,10 +16,8 @@ end -- run test with the given name function _run_test_filter(name) - local tests = {} local root = path.absolute(os.scriptdir()) - -- find the test script for _, script in ipairs(os.files(path.join(root, "**", name, "**", "test.lua"))) do if not script:find(".xmake", 1, true) then table.insert(tests, path.absolute(script)) @@ -55,9 +53,6 @@ function _run_test_filter(name) end end --- main entry function main(name) - - -- run the given test return _run_test_filter(name or "/") end diff --git a/tests/runner.lua b/tests/runner.lua index 17783f9e4..b3d578a6f 100644 --- a/tests/runner.lua +++ b/tests/runner.lua @@ -54,7 +54,7 @@ function main(script) if errors then errors = tostring(errors) end - if not errors:find("aborting because of ") then + if errors and not errors:find("aborting because of ") then context:print_error(errors, v, "unhandled error") else raise(errors) -- cgit v1.3.1