Skip to content

Commit

Permalink
Patch TestRunner for proper error code on exit.
Browse files Browse the repository at this point in the history
  • Loading branch information
codecop committed Feb 27, 2025
1 parent f3940e2 commit 2e03b52
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion io/tests/correctness/run.io
Original file line number Diff line number Diff line change
@@ -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)
)

0 comments on commit 2e03b52

Please sign in to comment.