From 2e03b52c8bc16ad930fcf6b0f30c4f761c93b015 Mon Sep 17 00:00:00 2001 From: Peter Kofler Date: Thu, 27 Feb 2025 13:48:46 +0100 Subject: [PATCH] Patch TestRunner for proper error code on exit. --- io/tests/correctness/run.io | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/io/tests/correctness/run.io b/io/tests/correctness/run.io index 57d03a5..2e9ca6a 100644 --- a/io/tests/correctness/run.io +++ b/io/tests/correctness/run.io @@ -1,2 +1,34 @@ #!/usr/bin/env io -TestSuite clone setPath(System launchPath) run + +// patch TestRunner to upstream Io's version +TestRunner run = method(testMap, + self cases := testMap # Storing a reference to the test map. + self runtime := Date secondsToRun( + testMap foreach(testCaseName, testSlotNames, + # Depending on the Lobby is kind of wacky, but that's + # all we can do, since Map only supports string keys. + testCase := Lobby getSlot(testCaseName) + testSlotNames foreach(name, + testCase setUp + exc := try(stopStatus(testCase doString(name))) + if(exc, error(testCaseName .. " " .. name, exc), success) + testCase tearDown + ) + ) + ) + + printExceptions + printSummary + self exceptions +) + +if(System args size > 1, + # Run specific tests. + System args slice(1) foreach(name, + Lobby doFile(System launchPath .. "\\" .. name) + ) + System exit(FileCollector run size) +, + # Run all tests in the current directory. + System exit(DirectoryCollector run size) +)