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
Copy file name to clipboardExpand all lines: Documentation/ABI/TestContent.md
+11-20Lines changed: 11 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,10 @@ or a third-party library are inadvertently loaded into the same process. If the
126
126
value at `type` does not match the test content record's expected type, the
127
127
accessor function must return `false` and must not modify `outValue`.
128
128
129
-
<!-- TODO: discuss this argument's value in Embedded Swift (no metatypes) -->
129
+
When building for **Embedded Swift**, the value passed as `type` by Swift
130
+
Testing is unspecified because type metadata pointers are not available in that
131
+
environment.
132
+
<!-- TODO: specify what they are instead (FQN type name C strings maybe?) -->
130
133
131
134
[^mightNotBeSwift]: Although this document primarily deals with Swift, the test
132
135
content record section is generally language-agnostic. The use of languages
@@ -146,25 +149,12 @@ The fourth argument to this function, `reserved`, is reserved for future use.
146
149
Accessor functions should assume it is `0` and must not access it.
147
150
148
151
The concrete Swift type of the value written to `outValue`, the type pointed to
149
-
by `type`, and the value pointed to by `hint` depend on the kind of record:
152
+
by `type`, and the value pointed to by `hint` depend on the kind of record.
150
153
151
-
- For test or suite declarations (kind `0x74657374`), the accessor produces a
152
-
structure of type `Testing.Test.Generator` that the testing library can use
153
-
to generate the corresponding test[^notAccessorSignature].
154
-
155
-
[^notAccessorSignature]: This level of indirection is necessary because
156
-
loading a test or suite declaration is an asynchronous operation, but C
157
-
functions cannot be `async`.
158
-
159
-
Test content records of this kind do not specify a type for `hint`. Always
160
-
pass `nil`.
161
-
162
-
- For exit test declarations (kind `0x65786974`), the accessor produces a
163
-
structure describing the exit test (of type `Testing.ExitTest`.)
164
-
165
-
Test content records of this kind accept a `hint` of type `Testing.ExitTest.ID`.
166
-
They only produce a result if they represent an exit test declared with the
167
-
same ID (or if `hint` is `nil`.)
154
+
The record kinds defined by Swift Testing (kinds `0x74657374` and `0x65786974`)
155
+
make use of the `DiscoverableAsTestContent` protocol in the `_TestDiscovery`
156
+
module and do not publicly expose the types of their accessor functions'
157
+
arguments. Do not call the accessor functions for these records directly.
168
158
169
159
> [!WARNING]
170
160
> Calling code should use [`withUnsafeTemporaryAllocation(of:capacity:_:)`](https://developer.apple.com/documentation/swift/withunsafetemporaryallocation(of:capacity:_:))
0 commit comments