Commit f4abd7a
authored
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.
1 parent 10ab127 commit f4abd7a
File tree
2 files changed
+66
-2
lines changed- Sources/Testing/Traits
- Tests/TestingTests/Traits
2 files changed
+66
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
92 | 131 | | |
93 | 132 | | |
94 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
60 | 85 | | |
61 | 86 | | |
62 | 87 | | |
| |||
0 commit comments