You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update Comment to use CustomTestStringConvertible during string interpolation. (#936)
This PR ensures that `Comment`, when constructed from a string literal
with interpolations, stringifies interpolated values using
`String.init(descriptionForTest:)` rather than the default behaviour
(i.e. `String.init(description:)`.)
For example:
```swift
enum E: CustomTestStringConvertible {
case a
case b
case c
var testDescription: String {
switch self {
case .a:
"Once I was the King of Spain"
case .b:
"Now I eat humble pie"
case .c:
"Now I vacuum the turf at SkyDome™"
}
}
}
#expect(1 == 2, "\(E.a) / \(E.b) / \(E.a) / \(E.c)")
```
Before:
> 🛑 Expectation failed: 1 == 2 - .a / .b / .a / .c
After:
> 🛑 Expectation failed: 1 == 2 - Once I was the King of Spain / Now I
eat
> humble pie / Once I was the King of Spain / Now I vacuum the turf at
SkyDome™
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
0 commit comments