File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Sources/ComposableArchitecture Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -2365,17 +2365,24 @@ class TestReducer<State, Action>: ReducerProtocol {
23652365 }
23662366}
23672367
2368- extension Task where Success == Never , Failure == Never {
2369- // NB: We would love if this was not necessary, but due to a lack of async testing tools in Swift
2370- // we're not sure if there is an alternative. See this forum post for more information:
2368+ extension Task where Success == Failure , Failure == Never {
2369+ // NB: We would love if this was not necessary. See this forum post for more information:
23712370 // https://forums.swift.org/t/reliably-testing-code-that-adopts-swift-concurrency/57304
2372- @_spi ( Internals) public static func megaYield( count: Int = 10 ) async {
2373- for _ in 1 ... count {
2371+ @_spi ( Internals) public static func megaYield( count: Int = defaultMegaYieldCount ) async {
2372+ for _ in 0 ..< count {
23742373 await Task < Void , Never > . detached ( priority: . background) { await Task . yield ( ) } . value
23752374 }
23762375 }
23772376}
23782377
2378+ @_spi ( Internals) public let defaultMegaYieldCount = max (
2379+ 0 ,
2380+ min (
2381+ ProcessInfo . processInfo. environment [ " TASK_MEGA_YIELD_COUNT " ] . flatMap ( Int . init) ?? 20 ,
2382+ 10_000
2383+ )
2384+ )
2385+
23792386// NB: Only needed until Xcode ships a macOS SDK that uses the 5.7 standard library.
23802387// See: https://forums.swift.org/t/xcode-14-rc-cannot-specialize-protocol-type/60171/15
23812388#if swift(>=5.7) && !os(macOS) && !targetEnvironment(macCatalyst)
You can’t perform that action at this time.
0 commit comments