3
3
* Proposal: [ ST-0009] ( 0009-attachments.md )
4
4
* Authors: [ Jonathan Grynspan] ( https://github.com/grynspan )
5
5
* Review Manager: [ Rachel Brindle] ( https://github.com/younata )
6
- * Status: ** Active Review (March 21 - April 8, 2025) **
6
+ * Status: ** Accepted **
7
7
* Bug: [ swiftlang/swift-testing #714 ] ( https://github.com/swiftlang/swift-testing/issues/714 )
8
8
* Implementation: [ swiftlang/swift-testing #973 ] ( https://github.com/swiftlang/swift-testing/pull/973 )
9
- * Review: ([ review] ( https://forums.swift.org/t/st-0009-attachments/78698 ) ), ([ pitch] ( https://forums.swift.org/t/pitch-attachments/78072 ) )
9
+ * Review: ([ acceptance ] ( https://forums.swift.org/t/accepted-with-modifications-st-0009-attachments/79193 ) ), ( [ review] ( https://forums.swift.org/t/st-0009-attachments/78698 ) ), ([ pitch] ( https://forums.swift.org/t/pitch-attachments/78072 ) )
10
10
11
11
## Introduction
12
12
@@ -170,8 +170,8 @@ conform:
170
170
/// A type should conform to this protocol if it can be represented as a
171
171
/// sequence of bytes that would be diagnostically useful if a test fails. If a
172
172
/// type cannot conform directly to this protocol (such as a non-final class or
173
- /// a type declared in a third-party module), you can create a container type
174
- /// that conforms to ``AttachableContainer `` to act as a proxy.
173
+ /// a type declared in a third-party module), you can create a wrapper type
174
+ /// that conforms to ``AttachableWrapper `` to act as a proxy.
175
175
public protocol Attachable : ~ Copyable {
176
176
/// An estimate of the number of bytes of memory needed to store this value as
177
177
/// an attachment.
@@ -242,12 +242,12 @@ conformances, Foundation must be imported because `JSONEncoder` and
242
242
243
243
Some types cannot conform directly to ` Attachable ` because they require
244
244
additional information to encode correctly, or because they are not directly
245
- ` Sendable ` or ` Copyable ` . A second protocol, ` AttachableContainer ` , is provided
245
+ ` Sendable ` or ` Copyable ` . A second protocol, ` AttachableWrapper ` , is provided
246
246
that refines ` Attachable ` :
247
247
248
248
``` swift
249
249
/// A protocol describing a type that can be attached to a test report or
250
- /// written to disk when a test is run and which contains another value that it
250
+ /// written to disk when a test is run and which wraps another value that it
251
251
/// stands in for.
252
252
///
253
253
/// To attach an attachable value to a test, pass it to ``Attachment/record(_:named:sourceLocation:)``.
@@ -259,21 +259,21 @@ that refines `Attachable`:
259
259
/// A type can conform to this protocol if it represents another type that
260
260
/// cannot directly conform to ``Attachable``, such as a non-final class or a
261
261
/// type declared in a third-party module.
262
- public protocol AttachableContainer <AttachableValue>: Attachable , ~ Copyable {
262
+ public protocol AttachableWrapper <AttachableValue>: Attachable , ~ Copyable {
263
263
/// The type of the attachable value represented by this type.
264
264
associatedtype AttachableValue
265
265
266
266
/// The attachable value represented by this instance.
267
267
var attachableValue: AttachableValue { get }
268
268
}
269
269
270
- extension Attachment where AttachableValue: AttachableContainer & ~Copyable {
270
+ extension Attachment where AttachableValue: AttachableWrapper & ~Copyable {
271
271
/// The value of this attachment.
272
272
///
273
- /// When the attachable value's type conforms to ``AttachableContainer ``, the
274
- /// value of this property equals the container 's underlying attachable value.
273
+ /// When the attachable value's type conforms to ``AttachableWrapper ``, the
274
+ /// value of this property equals the wrappers 's underlying attachable value.
275
275
/// To access the attachable value as an instance of `T` (where `T` conforms
276
- /// to ``AttachableContainer ``), specify the type explicitly:
276
+ /// to ``AttachableWrapper ``), specify the type explicitly:
277
277
///
278
278
/// ```swift
279
279
/// let attachableValue = attachment.attachableValue as T
@@ -286,7 +286,7 @@ The cross-import overlay with Foundation also provides the following convenience
286
286
interface for attaching the contents of a file or directory on disk:
287
287
288
288
``` swift
289
- extension Attachment where AttachableValue == _AttachableURLContainer {
289
+ extension Attachment where AttachableValue == _AttachableURLWrapper {
290
290
/// Initialize an instance of this type with the contents of the given URL.
291
291
///
292
292
/// - Parameters:
@@ -307,7 +307,7 @@ extension Attachment where AttachableValue == _AttachableURLContainer {
307
307
}
308
308
```
309
309
310
- ` _AttachableURLContainer ` is a type that conforms to ` AttachableContainer ` and
310
+ ` _AttachableURLWrapper ` is a type that conforms to ` AttachableWrapper ` and
311
311
encloses the URL and corresponding mapped data. As an implementation detail, it
312
312
is omitted from this proposal for brevity.
313
313
0 commit comments