Skip to content

Commit cb75fe5

Browse files
committed
More test fixes
- Fix VoiceMemosTests scheduler usage. - import Dispatch instead of CDispatch.NSEC_... for Linux.
1 parent 44c9777 commit cb75fe5

File tree

7 files changed

+8
-15
lines changed

7 files changed

+8
-15
lines changed

Examples/VoiceMemos/VoiceMemosTests/VoiceMemosTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class VoiceMemosTests: XCTestCase {
8181

8282
var environment = VoiceMemosEnvironment.unimplemented
8383
environment.audioRecorder.requestRecordPermission = { false }
84-
environment.mainRunLoop = ImmediateScheduler()
84+
environment.mainRunLoop = mainRunLoop
8585
environment.openSettings = { await didOpenSettings.setValue(true) }
8686

8787
let store = TestStore(
@@ -189,7 +189,7 @@ class VoiceMemosTests: XCTestCase {
189189

190190
var environment = VoiceMemosEnvironment.unimplemented
191191
environment.audioPlayer.play = { _ in throw SomeError() }
192-
environment.mainRunLoop = ImmediateScheduler()
192+
environment.mainRunLoop = mainRunLoop
193193

194194
let url = URL(fileURLWithPath: "pointfreeco/functions.m4a")
195195
let store = TestStore(
@@ -268,7 +268,7 @@ class VoiceMemosTests: XCTestCase {
268268
let url = URL(fileURLWithPath: "pointfreeco/functions.m4a")
269269
var environment = VoiceMemosEnvironment.unimplemented
270270
environment.audioPlayer.play = { _ in try await Task.never() }
271-
environment.mainRunLoop = TestScheduler()
271+
environment.mainRunLoop = mainRunLoop
272272

273273
let store = TestStore(
274274
initialState: VoiceMemosState(

Sources/ComposableArchitecture/Internal/Debug.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import CustomDump
22
import Foundation
33

4-
#if os(Linux) || os(Android)
5-
import let CDispatch.NSEC_PER_USEC
6-
import let CDispatch.NSEC_PER_SEC
7-
#endif
8-
94
extension String {
105
func indent(by indent: Int) -> String {
116
let indentation = String(repeating: " ", count: indent)

Sources/ComposableArchitecture/TestStore.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import XCTestDynamicOverlay
66

77
#if os(Linux)
8-
import let CDispatch.NSEC_PER_MSEC
9-
import let CDispatch.NSEC_PER_SEC
8+
import Dispatch
109
#endif
1110

1211
/// A testable runtime for a reducer.

Tests/ComposableArchitectureTests/EffectRunTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import XCTest
33
@testable import ComposableArchitecture
44

55
#if os(Linux)
6-
import let CDispatch.NSEC_PER_SEC
6+
import Dispatch
77
#endif
88

99
@MainActor

Tests/ComposableArchitectureTests/EffectTaskTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import XCTest
33
@testable import ComposableArchitecture
44

55
#if os(Linux)
6-
import let CDispatch.NSEC_PER_SEC
6+
import Dispatch
77
#endif
88

99
@MainActor

Tests/ComposableArchitectureTests/EffectTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import XCTest
44
@testable import ComposableArchitecture
55

66
#if os(Linux)
7-
import let CDispatch.NSEC_PER_MSEC
7+
import Dispatch
88
#endif
99

1010
@MainActor

Tests/ComposableArchitectureTests/ViewStoreTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import XCTest
77
#endif
88

99
#if os(Linux)
10-
import let CDispatch.NSEC_PER_MSEC
11-
import let CDispatch.NSEC_PER_SEC
10+
import Dispatch
1211
#endif
1312

1413
@MainActor

0 commit comments

Comments
 (0)