Contents

record(_:sourceLocation:)

Attach an attachment to the current test.

Declaration

static func record(_ attachment: consuming Attachment<AttachableValue>, sourceLocation: SourceLocation = #_sourceLocation)

Parameters

  • attachment:

    The attachment to attach.

  • sourceLocation:

    The source location of the call to this function.

Discussion

When attachableValue is an instance of a type that does not conform to the Sendable protocol, the testing library calls its withUnsafeBytes(for:_:) immediately and records a copy of the resulting buffer instead. If attachableValue throws an error when the testing library calls its withUnsafeBytes(for:_:) function, the testing library records that error as an issue in the current test.