Skip to content

Commit f7c9949

Browse files
committed
Fix Linux build
Add necessary compile time checks for linux build and tests to succeed.
1 parent ec77158 commit f7c9949

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

Sources/Dependencies/Internal/RuntimeWarnings.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ func runtimeWarn(
1111
let message = message()
1212
let category = category ?? "Runtime Warning"
1313
if _XCTIsTesting {
14-
if let file = file, let line = line {
15-
XCTFail(message, file: file, line: line)
16-
} else {
17-
XCTFail(message)
18-
}
14+
// `XCTExpectFailure` is not supported on Linux
15+
#if !os(Linux)
16+
if let file = file, let line = line {
17+
XCTFail(message, file: file, line: line)
18+
} else {
19+
XCTFail(message)
20+
}
21+
#endif
1922
} else {
2023
#if canImport(os)
2124
os_log(

Tests/ComposableArchitectureTests/ForEachReducerTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ final class ForEachReducerTests: XCTestCase {
3535
await store.send(.buttonTapped)
3636
}
3737

38-
#if DEBUG
38+
// `XCTExpectFailure` is not supported on Linux
39+
#if DEBUG && !os(Linux)
3940
func testMissingElement() async {
4041
let store = TestStore(
4142
initialState: Elements.State(),

Tests/ComposableArchitectureTests/IfCaseLetReducerTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ final class IfCaseLetReducerTests: XCTestCase {
3131
}
3232
}
3333

34-
#if DEBUG
34+
// `XCTExpectFailure` is not supported on Linux
35+
#if DEBUG && !os(Linux)
3536
func testNilChild() async {
3637
struct SomeError: Error, Equatable {}
3738

Tests/ComposableArchitectureTests/IfLetReducerTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import XCTest
33

44
@MainActor
55
final class IfLetReducerTests: XCTestCase {
6-
#if DEBUG
6+
// `XCTExpectFailure` is not supported on Linux
7+
#if DEBUG && !os(Linux)
78
func testNilChild() async {
89
let store = TestStore(
910
initialState: Int?.none,

Tests/ComposableArchitectureTests/ScopeTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ final class ScopeTests: XCTestCase {
4040
}
4141
}
4242

43-
#if DEBUG
43+
// `XCTExpectFailure` is not supported on Linux
44+
#if DEBUG && !os(Linux)
4445
func testNilChild() async {
4546
let store = TestStore(
4647
initialState: Child2.State.count(0),

Tests/DependenciesTests/DependencyValuesTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ final class DependencyValuesTests: XCTestCase {
9393
XCTAssertEqual(reuseClient.count(), 42)
9494

9595
DependencyValues.withValue(\.context, .live) {
96-
#if DEBUG
96+
// `XCTExpectFailure` is not supported on Linux
97+
#if DEBUG && !os(Linux)
9798
XCTExpectFailure {
9899
$0.compactDescription.contains(
99100
"""
@@ -124,7 +125,8 @@ final class DependencyValuesTests: XCTestCase {
124125
XCTAssertEqual($0.reuseClient.count(), 0)
125126
XCTAssertEqual(reuseClient.count(), 0)
126127
} operation: {
127-
#if DEBUG
128+
// `XCTExpectFailure` is not supported on Linux
129+
#if DEBUG && !os(Linux)
128130
XCTExpectFailure {
129131
$0.compactDescription.contains(
130132
"""

0 commit comments

Comments
 (0)