Skip to content

Commit aecd2a5

Browse files
committed
Make adjustments to Makefile and tests for Xcode 14.1
1 parent 42df531 commit aecd2a5

File tree

3 files changed

+11
-33
lines changed

3 files changed

+11
-33
lines changed

Makefile

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
PLATFORM_IOS = iOS Simulator,name=iPhone 11 Pro Max
22
PLATFORM_MACOS = macOS
33
PLATFORM_TVOS = tvOS Simulator,name=Apple TV
4-
PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 5 - 44mm
4+
PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 7 (45mm)
5+
56
default: test-all
67

78
test-all: test-library test-examples
@@ -34,27 +35,11 @@ test-docs:
3435
&& exit 1)
3536

3637
test-examples:
37-
xcodebuild test \
38-
-scheme "CaseStudies (SwiftUI)" \
39-
-destination platform="$(PLATFORM_IOS)"
40-
xcodebuild test \
41-
-scheme "CaseStudies (UIKit)" \
42-
-destination platform="$(PLATFORM_IOS)"
43-
xcodebuild test \
44-
-scheme Search \
45-
-destination platform="$(PLATFORM_IOS)"
46-
xcodebuild test \
47-
-scheme SpeechRecognition \
48-
-destination platform="$(PLATFORM_IOS)"
49-
xcodebuild test \
50-
-scheme TicTacToe \
51-
-destination platform="$(PLATFORM_IOS)"
52-
xcodebuild test \
53-
-scheme Todos \
54-
-destination platform="$(PLATFORM_IOS)"
55-
xcodebuild test \
56-
-scheme VoiceMemos \
57-
-destination platform="$(PLATFORM_IOS)"
38+
for scheme in "CaseStudies (SwiftUI)" "CaseStudies (UIKit)" Search SpeechRecognition TicTacToe Todos VoiceMemos; do \
39+
xcodebuild test \
40+
-scheme $$scheme \
41+
-destination platform="$(PLATFORM_IOS)"; \
42+
done
5843

5944
benchmark:
6045
swift run --configuration release \

Sources/ComposableArchitecture/ViewStore.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ private struct HashableWrapper<Value>: Hashable {
487487
public func yield(while predicate: @escaping (State) -> Bool) async {
488488
let cancellable = Box<Disposable?>(wrappedValue: nil)
489489
try? await withTaskCancellationHandler(
490-
handler: { cancellable.wrappedValue?.dispose() },
491490
operation: {
492491
try Task.checkCancellation()
493492
try await withUnsafeThrowingContinuation {
@@ -504,9 +503,9 @@ private struct HashableWrapper<Value>: Hashable {
504503
_ = cancellable
505504
}
506505
}
507-
}
506+
},
507+
onCancel: { cancellable.wrappedValue?.dispose() }
508508
)
509-
510509
}
511510
}
512511

Tests/ComposableArchitectureTests/ViewStoreTests.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ final class ViewStoreTests: XCTestCase {
172172
}
173173

174174
#if canImport(_Concurrency) && compiler(>=5.5.2)
175-
func testSendWhile() {
176-
let expectation = self.expectation(description: "await")
175+
func testSendWhile() async {
177176
Task { @MainActor in
178177
enum Action {
179178
case response
@@ -197,13 +196,10 @@ final class ViewStoreTests: XCTestCase {
197196
XCTAssertNoDifference(viewStore.state, false)
198197
await viewStore.send(.tapped, while: { $0 })
199198
XCTAssertNoDifference(viewStore.state, false)
200-
expectation.fulfill()
201199
}
202-
self.wait(for: [expectation], timeout: 1)
203200
}
204201

205-
func testSuspend() {
206-
let expectation = self.expectation(description: "await")
202+
func testSuspend() async {
207203
Task { @MainActor in
208204
enum Action {
209205
case response
@@ -229,9 +225,7 @@ final class ViewStoreTests: XCTestCase {
229225
XCTAssertNoDifference(viewStore.state, true)
230226
await viewStore.yield(while: { $0 })
231227
XCTAssertNoDifference(viewStore.state, false)
232-
expectation.fulfill()
233228
}
234-
self.wait(for: [expectation], timeout: 1)
235229
}
236230
#endif
237231
}

0 commit comments

Comments
 (0)