Skip to content

Commit 37c2568

Browse files
committed
Restructure the Swift Testing updates and add raw identifiers.
1 parent 66c2dd7 commit 37c2568

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

_posts/2025-NN-NN-swift-6.2-released.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -133,25 +133,19 @@ Swift 6.2 enables streaming transactional state changes of observable types usin
133133

134134
### Swift Testing
135135

136-
Swift Testing in Swift 6.2 supports [custom attachments](https://developer.apple.com/documentation/testing/attachments), letting you include additional context in your test results:
137-
138-
```swift
139-
@Test
140-
func validateProposalID() async throws {
141-
let (data, _) = try await URLSession.shared.data(from: evolutionJSONMetadataURL)
142-
Attachment.record(data, named: "evolution-metadata.json")
143-
144-
let jsonDecoder = JSONDecoder()
145-
let metadata = try jsonDecoder.decode(EvolutionMetadata.self, from: data)
146-
for proposal in metadata.proposals {
147-
#expect(proposal.id.starts(with: "SE"))
148-
}
149-
}
150-
```
151-
152-
You can attach strings, images, logs, and other artifacts directly to a test outcome. These attachments are included in test reports or written to disk, making it easier to diagnose failures with concrete evidence—whether that’s a screenshot of a UI state, a JSON payload, or a trace of steps leading up to the issue.
153-
154-
Swift Testing also supports [exit testing](https://developer.apple.com/documentation/testing/exit-testing), which lets you verify that code terminates under specific conditions, such as a failed precondition. Swift Testing will run your exit tests in a new process and validate that the exit behavior is what you expect. This makes it possible to exercise critical failure paths like you would in any other test.
136+
Swift Testing in Swift 6.2 adds new APIs for enhanced expressivity in your tests and test results:
137+
138+
* [**Exit testing**](https://developer.apple.com/documentation/testing/exit-testing) lets you verify that code terminates under specific conditions, such as a failed precondition. Your exit tests run in a new process and validate that the exit behavior is what you expect, making it possible to exercise critical failure paths like you would in any other test.
139+
* [**Custom attachments**](https://developer.apple.com/documentation/testing/attachments) let you include additional context in test results, including strings, images, logs, and other artifacts, surfaced in test reports or written to disk. This makes it easier to diagnose failures with concrete evidence—whether that’s a screenshot of a UI state, a JSON payload, or a trace of steps leading up to the issue.
140+
* [**Raw identifier display names**](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0451-escaped-identifiers.md) let you customize the names of test functions and suite types with less code:
141+
142+
```diff
143+
-@Test("square() returns x * x")
144+
-func squareIsXTimesX() {
145+
+@Test func `square() returns x * x`() {
146+
#expect(square(4) == 4 * 4)
147+
}
148+
```
155149

156150
## WebAssembly Support
157151

0 commit comments

Comments
 (0)