File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Tests/ComposableArchitectureTests Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ final class EffectTests: XCTestCase {
233
233
disposable. dispose ( )
234
234
}
235
235
236
- func testCancellingTask ( ) {
236
+ func testCancellingTask_Failable ( ) {
237
237
@Sendable func work( ) async throws -> Int {
238
238
try await Task . sleep ( nanoseconds: NSEC_PER_MSEC)
239
239
XCTFail ( )
@@ -251,5 +251,27 @@ final class EffectTests: XCTestCase {
251
251
disposable. dispose ( )
252
252
_ = XCTWaiter . wait ( for: [ . init( ) ] , timeout: 1.1 )
253
253
}
254
+
255
+ func testCancellingTask_Infalable( ) {
256
+ @Sendable func work( ) async -> Int {
257
+ do {
258
+ try await Task . sleep ( nanoseconds: NSEC_PER_MSEC)
259
+ XCTFail ( )
260
+ } catch {
261
+ }
262
+ return 42
263
+ }
264
+
265
+ Effect < Int , Never > . task { await work ( ) }
266
+ . sink (
267
+ receiveCompletion: { _ in XCTFail ( ) } ,
268
+ receiveValue: { _ in XCTFail ( ) }
269
+ )
270
+ . store ( in: & self . cancellables)
271
+
272
+ self . cancellables = [ ]
273
+
274
+ _ = XCTWaiter . wait ( for: [ . init( ) ] , timeout: 1.1 )
275
+ }
254
276
#endif
255
277
}
You can’t perform that action at this time.
0 commit comments