Skip to content

Commit 6bb6c5c

Browse files
committed
Container -> Wrapper
1 parent 7473e26 commit 6bb6c5c

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

Sources/Overlays/_Testing_CoreGraphics/Attachments/Attachment+AttachableAsCGImage.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ extension Attachment {
4242
contentType: (any Sendable)?,
4343
encodingQuality: Float,
4444
sourceLocation: SourceLocation
45-
) where AttachableValue == _AttachableImageContainer<T> {
46-
let imageContainer = _AttachableImageContainer(image: attachableValue, encodingQuality: encodingQuality, contentType: contentType)
47-
self.init(imageContainer, named: preferredName, sourceLocation: sourceLocation)
45+
) where AttachableValue == _AttachableImageWrapper<T> {
46+
let imageWrapper = _AttachableImageWrapper(image: attachableValue, encodingQuality: encodingQuality, contentType: contentType)
47+
self.init(imageWrapper, named: preferredName, sourceLocation: sourceLocation)
4848
}
4949

5050
/// Initialize an instance of this type that encloses the given image.
@@ -79,7 +79,7 @@ extension Attachment {
7979
as contentType: UTType?,
8080
encodingQuality: Float = 1.0,
8181
sourceLocation: SourceLocation = #_sourceLocation
82-
) where AttachableValue == _AttachableImageContainer<T> {
82+
) where AttachableValue == _AttachableImageWrapper<T> {
8383
self.init(attachableValue: attachableValue, named: preferredName, contentType: contentType, encodingQuality: encodingQuality, sourceLocation: sourceLocation)
8484
}
8585

@@ -109,7 +109,7 @@ extension Attachment {
109109
named preferredName: String? = nil,
110110
encodingQuality: Float = 1.0,
111111
sourceLocation: SourceLocation = #_sourceLocation
112-
) where AttachableValue == _AttachableImageContainer<T> {
112+
) where AttachableValue == _AttachableImageWrapper<T> {
113113
self.init(attachableValue: attachableValue, named: preferredName, contentType: nil, encodingQuality: encodingQuality, sourceLocation: sourceLocation)
114114
}
115115
}

Sources/Overlays/_Testing_CoreGraphics/Attachments/_AttachableImageContainer.swift renamed to Sources/Overlays/_Testing_CoreGraphics/Attachments/_AttachableImageWrapper.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import UniformTypeIdentifiers
4848
///
4949
/// - [`CGImage`](https://developer.apple.com/documentation/coregraphics/cgimage)
5050
@_spi(Experimental)
51-
public struct _AttachableImageContainer<Image>: Sendable where Image: AttachableAsCGImage {
51+
public struct _AttachableImageWrapper<Image>: Sendable where Image: AttachableAsCGImage {
5252
/// The underlying image.
5353
///
5454
/// `CGImage` and `UIImage` are sendable, but `NSImage` is not. `NSImage`
@@ -127,7 +127,7 @@ public struct _AttachableImageContainer<Image>: Sendable where Image: Attachable
127127

128128
// MARK: -
129129

130-
extension _AttachableImageContainer: AttachableContainer {
130+
extension _AttachableImageWrapper: AttachableWrapper {
131131
public var attachableValue: Image {
132132
image
133133
}

Sources/Overlays/_Testing_Foundation/Attachments/Attachment+URL.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extension URL {
3232
}
3333
}
3434

35-
extension Attachment where AttachableValue == _AttachableURLContainer {
35+
extension Attachment where AttachableValue == _AttachableURLWrapper {
3636
#if SWT_TARGET_OS_APPLE
3737
/// An operation queue to use for asynchronously reading data from disk.
3838
private static let _operationQueue = OperationQueue()
@@ -94,8 +94,8 @@ extension Attachment where AttachableValue == _AttachableURLContainer {
9494
}
9595
#endif
9696

97-
let urlContainer = _AttachableURLContainer(url: url, data: data, isCompressedDirectory: isDirectory)
98-
self.init(urlContainer, named: preferredName, sourceLocation: sourceLocation)
97+
let urlWrapper = _AttachableURLWrapper(url: url, data: data, isCompressedDirectory: isDirectory)
98+
self.init(urlWrapper, named: preferredName, sourceLocation: sourceLocation)
9999
}
100100
}
101101

Sources/Overlays/_Testing_Foundation/Attachments/_AttachableURLContainer.swift renamed to Sources/Overlays/_Testing_Foundation/Attachments/_AttachableURLWrapper.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public import Foundation
1717
///
1818
/// You do not need to use this type directly. Instead, initialize an instance
1919
/// of ``Attachment`` using a file URL.
20-
public struct _AttachableURLContainer: Sendable {
20+
public struct _AttachableURLWrapper: Sendable {
2121
/// The underlying URL.
2222
var url: URL
2323

@@ -30,7 +30,7 @@ public struct _AttachableURLContainer: Sendable {
3030

3131
// MARK: -
3232

33-
extension _AttachableURLContainer: AttachableContainer {
33+
extension _AttachableURLWrapper: AttachableWrapper {
3434
public var attachableValue: URL {
3535
url
3636
}

Sources/Overlays/_Testing_Foundation/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

99
add_library(_Testing_Foundation
10-
Attachments/_AttachableURLContainer.swift
10+
Attachments/_AttachableURLWrapper.swift
1111
Attachments/EncodingFormat.swift
1212
Attachments/Attachment+URL.swift
1313
Attachments/Attachable+NSSecureCoding.swift

Sources/Testing/Attachments/Attachable.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
/// A type should conform to this protocol if it can be represented as a
2525
/// sequence of bytes that would be diagnostically useful if a test fails. If a
2626
/// type cannot conform directly to this protocol (such as a non-final class or
27-
/// a type declared in a third-party module), you can create a container type
28-
/// that conforms to ``AttachableContainer`` to act as a proxy.
27+
/// a type declared in a third-party module), you can create a wrapper type that
28+
/// conforms to ``AttachableWrapper`` to act as a proxy.
2929
///
3030
/// @Metadata {
3131
/// @Available(Swift, introduced: 6.2)

Sources/Testing/Attachments/AttachableContainer.swift renamed to Sources/Testing/Attachments/AttachableWrapper.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/// @Metadata {
2626
/// @Available(Swift, introduced: 6.2)
2727
/// }
28-
public protocol AttachableContainer<AttachableValue>: Attachable, ~Copyable {
28+
public protocol AttachableWrapper<AttachableValue>: Attachable, ~Copyable {
2929
/// The type of the attachable value represented by this type.
3030
///
3131
/// @Metadata {

Sources/Testing/Attachments/Attachment.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extension Attachment where AttachableValue == AnyAttachable {
125125
}
126126
#endif
127127

128-
/// A type-erased container type that represents any attachable value.
128+
/// A type-erased wrapper type that represents any attachable value.
129129
///
130130
/// This type is not generally visible to developers. It is used when posting
131131
/// events of kind ``Event/Kind/valueAttached(_:)``. Test tools authors who use
@@ -137,7 +137,7 @@ extension Attachment where AttachableValue == AnyAttachable {
137137
// `Event.Kind.valueAttached(_:)`, otherwise it would be declared private.
138138
// }
139139
@_spi(ForToolsIntegrationOnly)
140-
public struct AnyAttachable: AttachableContainer, Copyable, Sendable {
140+
public struct AnyAttachable: AttachableWrapper, Copyable, Sendable {
141141
#if !SWT_NO_LAZY_ATTACHMENTS
142142
public typealias AttachableValue = any Attachable & Sendable /* & Copyable rdar://137614425 */
143143
#else
@@ -215,13 +215,13 @@ extension Attachment where AttachableValue: ~Copyable {
215215
}
216216
}
217217

218-
extension Attachment where AttachableValue: AttachableContainer & ~Copyable {
218+
extension Attachment where AttachableValue: AttachableWrapper & ~Copyable {
219219
/// The value of this attachment.
220220
///
221-
/// When the attachable value's type conforms to ``AttachableContainer``, the
222-
/// value of this property equals the container's underlying attachable value.
221+
/// When the attachable value's type conforms to ``AttachableWrapper``, the
222+
/// value of this property equals the wrapper's underlying attachable value.
223223
/// To access the attachable value as an instance of `T` (where `T` conforms
224-
/// to ``AttachableContainer``), specify the type explicitly:
224+
/// to ``AttachableWrapper``), specify the type explicitly:
225225
///
226226
/// ```swift
227227
/// let attachableValue = attachment.attachableValue as T
@@ -322,9 +322,9 @@ extension Attachment where AttachableValue: ~Copyable {
322322
public static func record(_ attachment: consuming Self, sourceLocation: SourceLocation = #_sourceLocation) {
323323
do {
324324
let attachmentCopy = try attachment.withUnsafeBytes { buffer in
325-
let attachableContainer = AnyAttachable(attachableValue: Array(buffer))
325+
let attachableWrapper = AnyAttachable(attachableValue: Array(buffer))
326326
return Attachment<AnyAttachable>(
327-
_attachableValue: attachableContainer,
327+
_attachableValue: attachableWrapper,
328328
fileSystemPath: attachment.fileSystemPath,
329329
_preferredName: attachment.preferredName, // invokes preferredName(for:basedOn:)
330330
sourceLocation: sourceLocation

Sources/Testing/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ add_library(Testing
2222
ABI/Encoded/ABI.EncodedMessage.swift
2323
ABI/Encoded/ABI.EncodedTest.swift
2424
Attachments/Attachable.swift
25-
Attachments/AttachableContainer.swift
25+
Attachments/AttachableWrapper.swift
2626
Attachments/Attachment.swift
2727
Events/Clock.swift
2828
Events/Event.swift

Sources/Testing/Testing.docc/Attachments.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protocol to create your own attachable types.
2323

2424
- ``Attachment``
2525
- ``Attachable``
26-
- ``AttachableContainer``
26+
- ``AttachableWrapper``
2727

2828
<!-- TODO: set up DocC content for overlays if possible
2929
### Attaching files to tests

0 commit comments

Comments
 (0)