Skip to content

Commit 44022f4

Browse files
authored
Rename ExitTestArtifacts and split ExitCondition in twain. (#975)
This PR renames `ExitTestArtifacts` to `ExitTest.Result` and splits `ExitCondition` into two types: `ExitTest.Condition` which can be passed to `#expect(exitsWith:)` and `StatusAtExit` which represents the raw, possibly platform-specific status reported by the kernel when a child process terminates. The latter type is not nested in `ExitTest` because it can be used independently of exit tests and we may want to use it in the future for things like multi-process parallelization, but if a platform supports spawning processes but not exit tests, nesting it in `ExitTest` would make it unavailable. I considered several names for `StatusAtExit`: - `ExitStatus`: too easily confusable with exit _codes_ such as `EXIT_SUCCESS`; - `ProcessStatus`: we don't say "process" in our API surface elsewhere; - `Status`: too generic - `ExitReason`: "status" is a more widely-used term of art for this concept. Foundation uses `terminationStatus` to represent the raw integer value and `Process.TerminationReason` to represent whether it's an exit code or signal. We don't use "termination" in Swift Testing's API anywhere. I settled on `StatusAtExit` because it was distinct and makes it clear that it represents the status of a process _at exit time_ (as opposed to while running, e.g. `enum ProcessStatus { case running; case suspended; case terminated }`. Updates to the exit tests proposal document will follow in a separate PR. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 66708a7 commit 44022f4

13 files changed

+392
-445
lines changed

Sources/Testing/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ add_library(Testing
3131
Events/Recorder/Event.JUnitXMLRecorder.swift
3232
Events/Recorder/Event.Symbol.swift
3333
Events/TimeValue.swift
34-
ExitTests/ExitCondition.swift
3534
ExitTests/ExitTest.swift
36-
ExitTests/ExitTestArtifacts.swift
35+
ExitTests/ExitTest.Condition.swift
36+
ExitTests/ExitTest.Result.swift
3737
ExitTests/SpawnProcess.swift
38+
ExitTests/StatusAtExit.swift
3839
ExitTests/WaitFor.swift
3940
Expectations/Expectation.swift
4041
Expectations/Expectation+Macro.swift

Sources/Testing/ExitTests/ExitCondition.swift

Lines changed: 0 additions & 236 deletions
This file was deleted.

0 commit comments

Comments
 (0)