You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change the return types of test content accessors and add ExitTest.current. (#974)
This PR changes the signatures of the accessor functions for the test
content metadata section so that we're not using underscored types.
Instead, a `Test.Generator` type replaces `Test._Record` and the bare
function type we were using for `Test` and `ExitTest` is promoted to
(still experimental) API instead of hiding behind underscores.
This change allows the types produced by accessor functions to always be
nominal types, avoids the iffy substitution of `_Record` for `@Sendable
() async -> Test` at runtime, and simplifies the internal `TestContent`
protocol by eliminating the need for an associated type to stand in for
the conforming type.
This change leaves `ExitTest` as a nominal, but empty, type. I've added
`ExitTest.current` to make it useful so that test code, especially
libraries, can detect if it's running inside an exit test or not. I will
separately update the exit test proposal PR to include this type and
property.
### 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.
Copy file name to clipboardExpand all lines: Sources/Testing/Test+Discovery.swift
+4-22Lines changed: 4 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -18,25 +18,12 @@ extension Test {
18
18
/// indirect `async` accessor function rather than directly producing
19
19
/// instances of ``Test``, but functions are non-nominal types and cannot
20
20
/// directly conform to protocols.
21
-
///
22
-
/// - Note: This helper type must have the exact in-memory layout of the
23
-
/// `async` accessor function. Do not add any additional cases or associated
24
-
/// values. The layout of this type is [guaranteed](https://github.com/swiftlang/swift/blob/main/docs/ABI/TypeLayout.rst#fragile-enum-layout)
0 commit comments