Skip to content

Commit c8c1110

Browse files
authored
Fix syntax of #expect(throws:) example in documentation (#172)
* Fix syntax of `#expect(throws:)` example in documentation * Fix two more incorrect usages
1 parent 039a328 commit c8c1110

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/Testing/Expectations/Expectation+Macro.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
/// - Parameters:
7777
/// - errorType: The type of error that is expected to be thrown. If
7878
/// `expression` could throw _any_ error, or the specific type of thrown
79-
/// error is unimportant, pass `any Error.self`.
79+
/// error is unimportant, pass `(any Error).self`.
8080
/// - comment: A comment describing the expectation.
8181
/// - sourceLocation: The source location to which recorded expectations and
8282
/// issues should be attributed.
@@ -153,7 +153,7 @@
153153
/// - Parameters:
154154
/// - errorType: The type of error that is expected to be thrown. If
155155
/// `expression` could throw _any_ error, or the specific type of thrown
156-
/// error is unimportant, pass `any Error.self`.
156+
/// error is unimportant, pass `(any Error).self`.
157157
/// - comment: A comment describing the expectation.
158158
/// - sourceLocation: The source location to which recorded expectations and
159159
/// issues should be attributed.

Sources/Testing/Testing.docc/MigratingFromXCTest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ their equivalents in the testing library:
349349
| `XCTAssertGreaterThanOrEqual(x, y)` | `#expect(x >= y)` |
350350
| `XCTAssertLessThanOrEqual(x, y)` | `#expect(x <= y)` |
351351
| `XCTAssertLessThan(x, y)` | `#expect(x < y)` |
352-
| `XCTAssertThrowsError(try f())` | `#expect(throws: any Error.self) { try f() }` |
352+
| `XCTAssertThrowsError(try f())` | `#expect(throws: (any Error).self) { try f() }` |
353353
| `XCTAssertNoThrow(try f())` | `#expect(throws: Never.self) { try f() }` |
354354
| `try XCTUnwrap(x)` | `try #require(x)` |
355355
| `XCTFail("…")` | `Issue.record("…")` |

0 commit comments

Comments
 (0)