Skip to content

Commit ffe5f4d

Browse files
committed
Adapt RuntimeWarningTests for ReactiveSwift and Linux.
1 parent b127ab2 commit ffe5f4d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Sources/ComposableArchitecture/Internal/RuntimeWarnings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#if DEBUG
2+
import XCTestDynamicOverlay
23
#if canImport(os)
34
import os
4-
import XCTestDynamicOverlay
55

66
// NB: Xcode runtime warnings offer a much better experience than traditional assertions and
77
// breakpoints, but Apple provides no means of creating custom runtime warnings ourselves.

Tests/ComposableArchitectureTests/RuntimeWarningTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import Combine
1+
import ReactiveSwift
22
import ComposableArchitecture
33
import XCTest
44

5+
// `XCTExpectFailure` is not supported on Linux
6+
#if !os(Linux)
57
final class RuntimeWarningTests: XCTestCase {
68
func testStoreCreationMainThread() {
79
XCTExpectFailure {
@@ -41,9 +43,8 @@ final class RuntimeWarningTests: XCTestCase {
4143
reducer: Reducer<Int, Action, Void> { state, action, _ in
4244
switch action {
4345
case .tap:
44-
return Empty()
45-
.receive(on: DispatchQueue(label: "background"))
46-
.eraseToEffect()
46+
return SignalProducer.none
47+
.observe(on: QueueScheduler(qos: .userInitiated, name: "test", targeting: DispatchQueue(label: "background")))
4748
case .response:
4849
return .none
4950
}
@@ -152,11 +153,9 @@ final class RuntimeWarningTests: XCTestCase {
152153
reducer: Reducer<Int, Action, Void> { state, action, _ in
153154
switch action {
154155
case .tap:
155-
return .run { subscriber in
156+
return Effect { subscriber, lifetime in
156157
DispatchQueue(label: "background").async {
157-
subscriber.send(.response)
158-
}
159-
return AnyCancellable {
158+
subscriber.send(value: .response)
160159
}
161160
}
162161
case .response:
@@ -198,3 +197,4 @@ final class RuntimeWarningTests: XCTestCase {
198197
}
199198
}
200199
}
200+
#endif

0 commit comments

Comments
 (0)