@@ -37,7 +37,7 @@ class ConnectionTests: XCTestCase {
37
37
XCTAssertEqual ( " a/b " , dec. string)
38
38
}
39
39
40
- func testEcho( ) {
40
+ func testEcho( ) async throws {
41
41
let client = connection. client
42
42
let expectation = self . expectation ( description: " response received " )
43
43
@@ -48,7 +48,7 @@ class ConnectionTests: XCTestCase {
48
48
expectation. fulfill ( )
49
49
}
50
50
51
- waitForExpectations ( timeout : defaultTimeout )
51
+ try await fulfillmentOfOrThrow ( [ expectation ] )
52
52
}
53
53
54
54
func testMessageBuffer( ) async throws {
@@ -95,7 +95,7 @@ class ConnectionTests: XCTestCase {
95
95
XCTAssert ( connection. serverToClientConnection. requestBufferIsEmpty)
96
96
}
97
97
98
- func testEchoError( ) {
98
+ func testEchoError( ) async throws {
99
99
let client = connection. client
100
100
let expectation = self . expectation ( description: " response received 1 " )
101
101
let expectation2 = self . expectation ( description: " response received 2 " )
@@ -114,7 +114,7 @@ class ConnectionTests: XCTestCase {
114
114
expectation2. fulfill ( )
115
115
}
116
116
117
- waitForExpectations ( timeout : defaultTimeout )
117
+ try await fulfillmentOfOrThrow ( [ expectation , expectation2 ] )
118
118
}
119
119
120
120
func testEchoNote( ) async throws {
@@ -131,7 +131,7 @@ class ConnectionTests: XCTestCase {
131
131
try await fulfillmentOfOrThrow ( [ expectation] )
132
132
}
133
133
134
- func testUnknownRequest( ) {
134
+ func testUnknownRequest( ) async throws {
135
135
let client = connection. client
136
136
let expectation = self . expectation ( description: " response received " )
137
137
@@ -145,10 +145,10 @@ class ConnectionTests: XCTestCase {
145
145
expectation. fulfill ( )
146
146
}
147
147
148
- waitForExpectations ( timeout : defaultTimeout )
148
+ try await fulfillmentOfOrThrow ( [ expectation ] )
149
149
}
150
150
151
- func testUnknownNotification( ) {
151
+ func testUnknownNotification( ) async throws {
152
152
let client = connection. client
153
153
let expectation = self . expectation ( description: " note received " )
154
154
@@ -167,10 +167,10 @@ class ConnectionTests: XCTestCase {
167
167
expectation. fulfill ( )
168
168
}
169
169
170
- waitForExpectations ( timeout : defaultTimeout )
170
+ try await fulfillmentOfOrThrow ( [ expectation ] )
171
171
}
172
172
173
- func testUnexpectedResponse( ) {
173
+ func testUnexpectedResponse( ) async throws {
174
174
let client = connection. client
175
175
let expectation = self . expectation ( description: " response received " )
176
176
@@ -186,10 +186,10 @@ class ConnectionTests: XCTestCase {
186
186
expectation. fulfill ( )
187
187
}
188
188
189
- waitForExpectations ( timeout : defaultTimeout )
189
+ try await fulfillmentOfOrThrow ( [ expectation ] )
190
190
}
191
191
192
- func testSendAfterClose( ) {
192
+ func testSendAfterClose( ) async throws {
193
193
let client = connection. client
194
194
let expectation = self . expectation ( description: " note received " )
195
195
@@ -206,7 +206,7 @@ class ConnectionTests: XCTestCase {
206
206
connection. clientToServerConnection. close ( )
207
207
connection. clientToServerConnection. close ( )
208
208
209
- waitForExpectations ( timeout : defaultTimeout )
209
+ try await fulfillmentOfOrThrow ( [ expectation ] )
210
210
}
211
211
212
212
func testSendBeforeClose( ) async throws {
@@ -229,7 +229,7 @@ class ConnectionTests: XCTestCase {
229
229
/// DispatchIO can make its callback at any time, so this test is to try to
230
230
/// provoke a race between those things and ensure the closeHandler is called
231
231
/// exactly once.
232
- func testCloseRace( ) {
232
+ func testCloseRace( ) async throws {
233
233
for _ in 0 ... 100 {
234
234
let to = Pipe ( )
235
235
let from = Pipe ( )
@@ -274,9 +274,8 @@ class ConnectionTests: XCTestCase {
274
274
#endif
275
275
conn. close ( )
276
276
277
- withExtendedLifetime ( conn) {
278
- waitForExpectations ( timeout: defaultTimeout)
279
- }
277
+ try await fulfillmentOfOrThrow ( [ expectation] )
278
+ withExtendedLifetime ( conn) { }
280
279
}
281
280
}
282
281
0 commit comments