Contents

Attachable

A protocol describing a type whose instances can be recorded and saved as part of a test run.

Declaration

protocol Attachable : ~Copyable

Mentioned in

Overview

To attach an attachable value to a test, pass it to record(_:named:sourceLocation:). To further configure an attachable value before you attach it, use it to initialize an instance of Attachment and set its properties before passing it to record(_:sourceLocation:).

The testing library provides default conformances to this protocol for a variety of standard library types. Most user-defined types do not need to conform to this protocol.

A type should conform to this protocol if it can be represented as a sequence of bytes that would be diagnostically useful if a test fails. If a type cannot conform directly to this protocol (such as a non-final class or a type declared in a third-party module), you can create a wrapper type that conforms to AttachableWrapper to act as a proxy.

Topics

Instance Properties

Instance Methods

See Also

Attaching values to tests