File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# SwiftAsyncAssert
22
3- XCTAssert variants to evaluate async expressions in XCTests.
3+ Assert functions to evaluate Swift concurrency async expressions in XCTests.
4+
5+ > The Missing concurrency functions in ` XCTest ` framework
6+
7+ ---
8+
9+ Instead of writing
10+
11+ ``` swift
12+ import XCTest
13+
14+ func test_should_succeed () async
15+ do {
16+ let isTrue = try await shouldSucceed ()
17+ XCTAssertTrue (isTrue)
18+ } catch {
19+ XCFail (" Should not throw an error" )
20+ }
21+ }
22+ ```
23+
24+ conveniently write
25+
26+ ``` swift
27+ import SwiftAsyncAssert
28+
29+ func test_should_succeed () async
30+ await AsyncAssertTrue (try await shouldSucceed ())
31+ }
32+
33+ func test_should_throwError () async
34+ await AsyncAssertThrowsError (try await shouldFail ())
35+ }
36+ ```
37+
38+ Less code for your convenience when testing!
You can’t perform that action at this time.
0 commit comments