[Xcode 13] Update tests so they pass in Combine compatibility mode
This commit is contained in:
committed by
Sergej Jaskiewicz
parent
866d837cdf
commit
f69bf6af64
+19
-10
@@ -120,36 +120,43 @@ jobs:
|
||||
environment:
|
||||
SWIFT_VERSION: "5.4.0"
|
||||
<<: *macOS_tests_steps
|
||||
|
||||
"Execute compatibility tests on iOS 14.5 (Xcode 12.5.1, Swift 5.4.0)":
|
||||
|
||||
"Execute tests on macOS 11.5.2 (Xcode 13.0.0, Swift 5.5.0)":
|
||||
macos:
|
||||
xcode: "12.5.1"
|
||||
xcode: "13.0.0"
|
||||
environment:
|
||||
SWIFT_VERSION: "5.4.0"
|
||||
SWIFT_VERSION: "5.5.0"
|
||||
<<: *macOS_tests_steps
|
||||
|
||||
"Execute compatibility tests on iOS 15.0 (Xcode 13.0.0, Swift 5.5.0)":
|
||||
macos:
|
||||
xcode: "13.0.0"
|
||||
environment:
|
||||
SWIFT_VERSION: "5.5.0"
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Generating Xcode project
|
||||
command: make generate-compatibility-xcodeproj
|
||||
- run:
|
||||
name: Building for testing on iOS 14.5 with xcodebuild
|
||||
name: Building for testing on iOS 15.0 with xcodebuild
|
||||
command: |
|
||||
set -o pipefail \
|
||||
&& xcodebuild build-for-testing \
|
||||
-scheme OpenCombine-Package \
|
||||
-destination "platform=iOS Simulator,name=iPhone 12,OS=14.5" \
|
||||
-destination "platform=iOS Simulator,name=iPhone 12,OS=15.0" \
|
||||
-derivedDataPath DerivedData \
|
||||
| tee xcodebuild_build-for-testing.log \
|
||||
| xcpretty
|
||||
- store_artifacts:
|
||||
path: xcodebuild_build-for-testing.log
|
||||
- run:
|
||||
name: Testing against Combine on iOS 14.5 with xcodebuild
|
||||
name: Testing against Combine on iOS 15.0 with xcodebuild
|
||||
command: |
|
||||
set -o pipefail \
|
||||
&& xcodebuild test-without-building \
|
||||
-scheme OpenCombine-Package \
|
||||
-destination "platform=iOS Simulator,name=iPhone 12,OS=14.5" \
|
||||
-destination "platform=iOS Simulator,name=iPhone 12,OS=15.0" \
|
||||
-derivedDataPath DerivedData \
|
||||
| tee xcodebuild_test-without-building.log \
|
||||
| xcpretty --report junit -o build/reports/results.xml
|
||||
@@ -230,10 +237,12 @@ workflows:
|
||||
jobs:
|
||||
- "Execute tests on macOS 10.15.0 (Xcode 11.3.0, Swift 5.1.3)"
|
||||
- "Execute tests on macOS 10.15.0 (Xcode 12.1.0, Swift 5.3.0)"
|
||||
- "Execute tests on macOS 11.4.0 (Xcode 12.5.1, Swift 5.4.0)"
|
||||
- "Execute tests on macOS 11.4.0 (Xcode 12.5.0, Swift 5.4.0)"
|
||||
- "Execute tests on macOS 11.5.2 (Xcode 13.0.0, Swift 5.5.0)"
|
||||
"OpenCombine: execute compatibility tests":
|
||||
jobs:
|
||||
- "Execute compatibility tests on macOS 11.4.0 (Xcode 12.5.1, Swift 5.4.0)"
|
||||
- "Execute compatibility tests on iOS 15.0 (Xcode 13.0.0, Swift 5.5.0)"
|
||||
# - "Execute compatibility tests on macOS 11.4.0 (Xcode 12.5.0, Swift 5.4.0)"
|
||||
"OpenCombine: execute tests on Linux":
|
||||
jobs:
|
||||
- "Execute tests on Ubuntu 18.04 (Swift 5.0)"
|
||||
|
||||
@@ -259,24 +259,22 @@ final class DispatchQueueSchedulerTests: XCTestCase {
|
||||
XCTAssertEqual(Stride(exactly: 2 as UInt64)?.magnitude, 2_000_000_000)
|
||||
}
|
||||
|
||||
func testStrideFromTooMuchSecondsCrashes() {
|
||||
assertCrashes {
|
||||
func testStrideFromTooMuchSeconds() {
|
||||
#if arch(x86_64) || arch(arm64) || arch(s390x) || arch(powerpc64) || arch(powerpc64le)
|
||||
// 64-bit platforms
|
||||
XCTAssertGreaterThan(
|
||||
Stride.seconds(Double(Int.max) / 1_000_000_000).magnitude,
|
||||
.max
|
||||
)
|
||||
// 64-bit platforms
|
||||
XCTAssertEqual(
|
||||
Stride.seconds(Double(Int.max) / 1_000_000_000).magnitude,
|
||||
.max
|
||||
)
|
||||
#elseif arch(i386) || arch(arm)
|
||||
// 32-bit platforms
|
||||
XCTAssertGreaterThan(
|
||||
Stride.seconds(Double(Int.max) / 1_000_000_000 + 1).magnitude,
|
||||
.max
|
||||
)
|
||||
// 32-bit platforms
|
||||
XCTAssertEqual(
|
||||
Stride.seconds(Double(Int.max) / 1_000_000_000).magnitude,
|
||||
.max
|
||||
)
|
||||
#else
|
||||
#error("This architecture isn't known. Add it to the 32-bit or 64-bit line.")
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
func testStrideComparable() {
|
||||
@@ -443,7 +441,7 @@ final class DispatchQueueSchedulerTests: XCTestCase {
|
||||
.encode(KeyedWrapper(value: stride))
|
||||
let encodedString = String(decoding: encodedData, as: UTF8.self)
|
||||
|
||||
XCTAssertEqual(encodedString, #"{"value":{"magnitude":419872}}"#)
|
||||
XCTAssertEqual(encodedString, #"{"value":{"_nanoseconds":419872}}"#)
|
||||
|
||||
let decodedStride = try decoder
|
||||
.decode(KeyedWrapper<Stride>.self, from: encodedData)
|
||||
|
||||
@@ -68,7 +68,7 @@ final class ReplaceErrorTests: XCTestCase {
|
||||
.completion(.finished)])
|
||||
}
|
||||
|
||||
func testSendingErrorWithNoDemandThenFinish() {
|
||||
func testSendingErrorWithNoDemandThenFinish() throws {
|
||||
let helper = OperatorTestHelper(publisherType: CustomPublisher.self,
|
||||
initialDemand: nil,
|
||||
receiveValueDemand: .none,
|
||||
@@ -77,7 +77,12 @@ final class ReplaceErrorTests: XCTestCase {
|
||||
helper.publisher.send(completion: .failure(.oops))
|
||||
helper.publisher.send(completion: .finished)
|
||||
|
||||
XCTAssertEqual(helper.tracking.history, [.subscription("ReplaceError")])
|
||||
|
||||
try XCTUnwrap(helper.downstreamSubscription).request(.max(1))
|
||||
|
||||
XCTAssertEqual(helper.tracking.history, [.subscription("ReplaceError"),
|
||||
.value(42),
|
||||
.completion(.finished)])
|
||||
}
|
||||
|
||||
@@ -164,7 +169,7 @@ final class ReplaceErrorTests: XCTestCase {
|
||||
|
||||
replaceError.subscribe(tracking)
|
||||
|
||||
XCTAssertEqual(tracking.history, [.subscription("ReplaceError")])
|
||||
XCTAssertEqual(tracking.history, [])
|
||||
|
||||
let subscription = CustomSubscription()
|
||||
publisher.send(subscription: subscription)
|
||||
@@ -225,7 +230,7 @@ final class ReplaceErrorTests: XCTestCase {
|
||||
func testReplaceErrorReceiveValueBeforeSubscription() {
|
||||
testReceiveValueBeforeSubscription(
|
||||
value: 0,
|
||||
expected: .history([.subscription("ReplaceError")], demand: .none),
|
||||
expected: .history([], demand: .none),
|
||||
{ $0.replaceError(with: 1) }
|
||||
)
|
||||
}
|
||||
@@ -233,7 +238,7 @@ final class ReplaceErrorTests: XCTestCase {
|
||||
func testReplaceErrorCompletionBeforeSubscription() {
|
||||
testReceiveCompletionBeforeSubscription(
|
||||
inputType: Int.self,
|
||||
expected: .history([.subscription("ReplaceError")]),
|
||||
expected: .history([]),
|
||||
{ $0.replaceError(with: 1) }
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user