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
Make all test content types directly conform to TestContent. (#920)
This PR eliminates the `TestContentAccessorResult` associated type from
the (currently internal, potentially eventually API) `TestContent`
protocol. This associated type needed to be `~Copyable` so `ExitTest`
could be used with it, but that appears to pose some _problems_ for the
compiler (rdar://143049814&143080508).
Instead, we remove the associated type and just say "the test content
record is the type that conforms to `TestContent`". `ExitTest` is happy
with this, but `Test`'s produced type is a non-nominal function type, so
we wrap that function in a small private type with identical layout and
have that type conform.
The ultimate purpose of this PR is to get us a bit closer to turning
`TestContent` into a public or tools-SPI protocol that other components
can use for test discovery.
### 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
+26-6
Original file line number
Diff line number
Diff line change
@@ -10,12 +10,27 @@
10
10
11
11
privateimport _TestingInternals
12
12
13
-
extensionTest:TestContent{
14
-
staticvartestContentKind:UInt32{
15
-
0x74657374
16
-
}
13
+
extensionTest{
14
+
/// A type that encapsulates test content records that produce instances of
15
+
/// ``Test``.
16
+
///
17
+
/// This type is necessary because such test content records produce an
18
+
/// indirect `async` accessor function rather than directly producing
19
+
/// instances of ``Test``, but functions are non-nominal types and cannot
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