swiftlang / swift-testing

A modern, expressive testing package for Swift
Apache License 2.0
1.81k stars 77 forks source link

[WIP] Add an associated `AttachmentMetadata` type to `Attachable`. #824

Open grynspan opened 1 week ago

grynspan commented 1 week ago

This PR adds a new associated type to Attachable that can be used to supply additional metadata to an attachment that is specific to that type. Metadata is always optional and the default type is Never (i.e. by default there is no metadata.)

The Encodable and NSSecureCoding conformances in the Foundation cross-import overlay have been updated such that this type equals a new structure that describes the format to use as well as options to pass to the JSON encoder (if one is used) and user info to pass to the plist or JSON encoders (if used.) We must use this type even for types that conform only to NSSecureCoding, otherwise we get compile-time errors about the type being ambiguous if a type conforms to both protocols and to Attachable.

Checklist:

grynspan commented 1 week ago

@swift-ci test