Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 915a7efaf5 | |||
| 024e576b0f | |||
| f4a611e95f | |||
| c09e47f792 | |||
| dd6be33016 | |||
| 5af4fb6ba4 | |||
| 0ca4c7658f | |||
| 8cf59d6d2a |
@@ -63,9 +63,9 @@ jobs:
|
||||
command: |
|
||||
bash <(curl -s https://codecov.io/bash) -D DerivedData
|
||||
|
||||
"Execute compatibility tests on iOS 13.5 (Xcode 11.5.0, Swift 5.2.4)":
|
||||
"Execute compatibility tests on iOS 13.6 (Xcode 11.6.0, Swift 5.2.4)":
|
||||
macos:
|
||||
xcode: "11.5.0"
|
||||
xcode: "11.6.0"
|
||||
environment:
|
||||
SWIFT_VERSION: "5.2.4"
|
||||
steps:
|
||||
@@ -74,24 +74,24 @@ jobs:
|
||||
name: Generating Xcode project
|
||||
command: make generate-compatibility-xcodeproj
|
||||
- run:
|
||||
name: Building for testing on iOS 13.5 with xcodebuild
|
||||
name: Building for testing on iOS 13.6 with xcodebuild
|
||||
command: |
|
||||
set -o pipefail \
|
||||
&& xcodebuild build-for-testing \
|
||||
-scheme OpenCombine-Package \
|
||||
-destination "platform=iOS Simulator,name=iPhone 11,OS=13.5" \
|
||||
-destination "platform=iOS Simulator,name=iPhone 11,OS=13.6" \
|
||||
-derivedDataPath DerivedData \
|
||||
| tee xcodebuild_build-for-testing.log \
|
||||
| xcpretty
|
||||
- store_artifacts:
|
||||
path: xcodebuild_build-for-testing.log
|
||||
- run:
|
||||
name: Testing against Combine on iOS 13.5 with xcodebuild
|
||||
name: Testing against Combine on iOS 13.6 with xcodebuild
|
||||
command: |
|
||||
set -o pipefail \
|
||||
&& xcodebuild test-without-building \
|
||||
-scheme OpenCombine-Package \
|
||||
-destination "platform=iOS Simulator,name=iPhone 11,OS=13.5" \
|
||||
-destination "platform=iOS Simulator,name=iPhone 11,OS=13.6" \
|
||||
-derivedDataPath DerivedData \
|
||||
| tee xcodebuild_test-without-building.log \
|
||||
| xcpretty --report junit -o build/reports/results.xml
|
||||
@@ -259,7 +259,7 @@ workflows:
|
||||
- "Execute tests on macOS 10.15.0 (Xcode 11.3.0, Swift 5.1.3)"
|
||||
"OpenCombine: execute compatibility tests":
|
||||
jobs:
|
||||
- "Execute compatibility tests on iOS 13.5 (Xcode 11.5.0, Swift 5.2.4)"
|
||||
- "Execute compatibility tests on iOS 13.6 (Xcode 11.6.0, Swift 5.2.4)"
|
||||
"OpenCombine: execute tests on iOS":
|
||||
jobs:
|
||||
- "Execute tests on iOS 9.3 (Xcode 10.2.1, Swift 5.0.1)"
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ GEM
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
json (2.2.0)
|
||||
json (2.3.1)
|
||||
jwt (2.1.0)
|
||||
memoist (0.16.1)
|
||||
mime-types (3.3)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = "OpenCombine"
|
||||
spec.version = "0.10.0"
|
||||
spec.version = "0.10.1"
|
||||
spec.summary = "Open source implementation of Apple's Combine framework for processing values over time."
|
||||
|
||||
spec.description = <<-DESC
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = "OpenCombineDispatch"
|
||||
spec.version = "0.10.0"
|
||||
spec.version = "0.10.1"
|
||||
spec.summary = "OpenCombine + Dispatch interoperability"
|
||||
|
||||
spec.description = <<-DESC
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = "OpenCombineFoundation"
|
||||
spec.version = "0.10.0"
|
||||
spec.version = "0.10.1"
|
||||
spec.summary = "OpenCombine + OpenCombineFoundation interoperability"
|
||||
|
||||
spec.description = <<-DESC
|
||||
|
||||
@@ -23,7 +23,7 @@ To add `OpenCombine` to your [SPM](https://swift.org/package-manager/) package,
|
||||
|
||||
```swift
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/OpenCombine/OpenCombine.git", from: "0.10.0")
|
||||
.package(url: "https://github.com/OpenCombine/OpenCombine.git", from: "0.10.1")
|
||||
],
|
||||
targets: [
|
||||
.target(name: "MyAwesomePackage", dependencies: ["OpenCombine",
|
||||
@@ -46,9 +46,9 @@ To do so, open Xcode, use **File** → **Swift Packages** → **Add Package Depe
|
||||
To add `OpenCombine` to a project using [CocoaPods](https://cocoapods.org/), add `OpenCombine` and `OpenCombineDispatch` to the list of target dependencies in your `Podfile`.
|
||||
|
||||
```ruby
|
||||
pod 'OpenCombine', '~> 0.10'
|
||||
pod 'OpenCombineDispatch', '~> 0.10'
|
||||
pod 'OpenCombineFoundation', '~> 0.10'
|
||||
pod 'OpenCombine', '~> 0.10.1'
|
||||
pod 'OpenCombineDispatch', '~> 0.10.1'
|
||||
pod 'OpenCombineFoundation', '~> 0.10.1'
|
||||
```
|
||||
|
||||
### Contributing
|
||||
@@ -57,7 +57,7 @@ In order to work on this project you will need Xcode 10.2 and Swift 5.0 or later
|
||||
|
||||
Please refer to the [issue #1](https://github.com/OpenCombine/OpenCombine/issues/1) for the list of operators that remain unimplemented, as well as the [RemainingCombineInterface.swift](https://github.com/OpenCombine/OpenCombine/blob/master/RemainingCombineInterface.swift) file. The latter contains the generated interface of Apple's Combine from the latest Xcode 11 version. When the functionality is implemented in OpenCombine, it should be removed from the RemainingCombineInterface.swift file.
|
||||
|
||||
You can refer to [this gist](https://gist.github.com/broadwaylamb/c2c8550d76b3ff851c4c1dbf0a872e26) to observe Apple's Combine API changes between different Xcode (beta) versions, or to [this gist](https://gist.github.com/broadwaylamb/82dc2ce4ffbe06527c2c352b8f10910f) to see the relevant contents of the .swiftinterface file for Combine.
|
||||
You can refer to [this repo](https://github.com/OpenCombine/combine-interfaces) to observe Apple's Combine API and documentation changes between different Xcode (beta) versions.
|
||||
|
||||
You can run compatibility tests against Apple's Combine. In order to do that you will need either macOS 10.14 with iOS 13 simulator installed (since the only way we can get Apple's Combine on macOS 10.14 is using the simulator), or macOS 10.15 (Apple's Combine is bundled with the OS). Execute the following command from the root of the package:
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ public struct AnySubscriber<Input, Failure: Error>: Subscriber,
|
||||
|
||||
if let playgroundDescription = subscriber as? CustomPlaygroundDisplayConvertible {
|
||||
playgroundDescriptionThunk = { playgroundDescription.playgroundDescription }
|
||||
} else if let desccription = subscriber as? CustomStringConvertible {
|
||||
playgroundDescriptionThunk = { desccription.description }
|
||||
} else if let description = subscriber as? CustomStringConvertible {
|
||||
playgroundDescriptionThunk = { description.description }
|
||||
} else {
|
||||
let fixedDescription = String(describing: type(of: subscriber))
|
||||
playgroundDescriptionThunk = { fixedDescription }
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
///
|
||||
/// Filter-like operators send an instance of their `Inner` class that is subclass
|
||||
/// of this class to the upstream publisher (as subscriber) and
|
||||
/// to the downstream subcriber (as subscription).
|
||||
/// to the downstream subscriber (as subscription).
|
||||
///
|
||||
/// Filter-like operators include `Publishers.Filter`,
|
||||
/// `Publishers.RemoveDuplicates`, `Publishers.PrefixWhile` and more.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
///
|
||||
/// Reduce-like operators send an instance of their `Inner` class that is subclass
|
||||
/// of this class to the upstream publisher (as subscriber) and
|
||||
/// to the downstream subcriber (as subsription).
|
||||
/// to the downstream subscriber (as subscription).
|
||||
///
|
||||
/// Reduce-like operators include `Publishers.Reduce`, `Publishers.TryReduce`,
|
||||
/// `Publishers.Count`, `Publishers.FirstWhere`, `Publishers.AllSatisfy` and more.
|
||||
|
||||
@@ -12,7 +12,7 @@ internal enum SubscriptionStatus {
|
||||
}
|
||||
|
||||
extension SubscriptionStatus {
|
||||
internal var isAwaigingSubscription: Bool {
|
||||
internal var isAwaitingSubscription: Bool {
|
||||
switch self {
|
||||
case .awaitingSubscription:
|
||||
return true
|
||||
|
||||
@@ -235,7 +235,7 @@ extension Optional.OCombine.Publisher {
|
||||
in range: RangeExpression
|
||||
) -> Optional<Output>.OCombine.Publisher where RangeExpression.Bound == Int {
|
||||
let range = range.relative(to: 0 ..< Int.max)
|
||||
precondition(range.lowerBound >= 0, "lowerBould must not be negative")
|
||||
precondition(range.lowerBound >= 0, "lowerBound must not be negative")
|
||||
|
||||
// I don't know why, but Combine has this precondition
|
||||
precondition(range.upperBound < .max - 1)
|
||||
|
||||
@@ -85,7 +85,7 @@ extension Publisher {
|
||||
|
||||
extension Publishers {
|
||||
|
||||
/// A publisher that emits all of one publisher’s elements before those from anothe
|
||||
/// A publisher that emits all of one publisher’s elements before those from another
|
||||
/// publisher.
|
||||
public struct Concatenate<Prefix: Publisher, Suffix: Publisher>: Publisher
|
||||
where Prefix.Failure == Suffix.Failure, Prefix.Output == Suffix.Output
|
||||
|
||||
@@ -146,7 +146,7 @@ extension Publishers.Debounce {
|
||||
|
||||
func receive(_ input: Input) -> Subscribers.Demand {
|
||||
lock.lock()
|
||||
precondition(!state.isAwaigingSubscription)
|
||||
precondition(!state.isAwaitingSubscription)
|
||||
guard case .subscribed = state else {
|
||||
lock.unlock()
|
||||
return .none
|
||||
@@ -172,7 +172,7 @@ extension Publishers.Debounce {
|
||||
|
||||
func receive(completion: Subscribers.Completion<Upstream.Failure>) {
|
||||
lock.lock()
|
||||
precondition(!state.isAwaigingSubscription)
|
||||
precondition(!state.isAwaitingSubscription)
|
||||
guard case .subscribed = state else {
|
||||
lock.unlock()
|
||||
return
|
||||
@@ -190,7 +190,7 @@ extension Publishers.Debounce {
|
||||
|
||||
func request(_ demand: Subscribers.Demand) {
|
||||
lock.lock()
|
||||
precondition(!state.isAwaigingSubscription)
|
||||
precondition(!state.isAwaitingSubscription)
|
||||
guard case .subscribed = state else {
|
||||
lock.unlock()
|
||||
return
|
||||
|
||||
@@ -24,7 +24,7 @@ extension Publisher {
|
||||
/// - Parameter predicate: A closure that takes an element as a parameter and
|
||||
/// returns a Boolean value that indicates whether to publish the element.
|
||||
/// - Returns: A publisher that only publishes the first element of a stream
|
||||
/// that satifies the predicate.
|
||||
/// that satisfies the predicate.
|
||||
public func first(
|
||||
where predicate: @escaping (Output) -> Bool
|
||||
) -> Publishers.FirstWhere<Self> {
|
||||
@@ -40,7 +40,7 @@ extension Publisher {
|
||||
/// - Parameter predicate: A closure that takes an element as a parameter and
|
||||
/// returns a Boolean value that indicates whether to publish the element.
|
||||
/// - Returns: A publisher that only publishes the first element of a stream
|
||||
/// that satifies the predicate.
|
||||
/// that satisfies the predicate.
|
||||
public func tryFirst(
|
||||
where predicate: @escaping (Output) throws -> Bool
|
||||
) -> Publishers.TryFirstWhere<Self> {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
extension Publisher {
|
||||
|
||||
/// Ingores all upstream elements, but passes along a completion
|
||||
/// Ignores all upstream elements, but passes along a completion
|
||||
/// state (finished or failed).
|
||||
///
|
||||
/// The output type of this publisher is `Never`.
|
||||
|
||||
@@ -59,7 +59,7 @@ extension Publishers {
|
||||
/// for purposes of filtering.
|
||||
public let predicate: (Output, Output) -> Bool
|
||||
|
||||
/// Creates a publisher that publishes only elements that don’t match the previou
|
||||
/// Creates a publisher that publishes only elements that don’t match the previous
|
||||
/// element, as evaluated by a provided closure.
|
||||
///
|
||||
/// - Parameter upstream: The publisher from which this publisher receives
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
extension Publisher {
|
||||
|
||||
/// Replaces nil elements in the stream with the proviced element.
|
||||
/// Replaces nil elements in the stream with the provided element.
|
||||
///
|
||||
/// - Parameter output: The element to use when replacing `nil`.
|
||||
/// - Returns: A publisher that replaces `nil` elements from
|
||||
|
||||
@@ -9,7 +9,7 @@ extension Publisher {
|
||||
|
||||
/// Returns a publisher as a class instance.
|
||||
///
|
||||
/// The downstream subscriber receieves elements and completion states unchanged from
|
||||
/// The downstream subscriber receives elements and completion states unchanged from
|
||||
/// the upstream publisher. Use this operator when you want to use
|
||||
/// reference semantics, such as storing a publisher instance in a property.
|
||||
///
|
||||
|
||||
@@ -23,7 +23,7 @@ public protocol SchedulerTimeIntervalConvertible {
|
||||
///
|
||||
/// A scheduler used to execute code as soon as possible, or after a future date.
|
||||
/// Individual scheduler implementations use whatever time-keeping system makes sense
|
||||
/// for them. Schdedulers express this as their `SchedulerTimeType`. Since this type
|
||||
/// for them. Schedulers express this as their `SchedulerTimeType`. Since this type
|
||||
/// conforms to `SchedulerTimeIntervalConvertible`, you can always express these times
|
||||
/// with the convenience functions like `.milliseconds(500)`. Schedulers can accept
|
||||
/// options to control how they execute the actions passed to them. These options may
|
||||
|
||||
@@ -27,7 +27,7 @@ public protocol Subscriber: CustomCombineIdentifierConvertible {
|
||||
/// Tells the subscriber that the publisher has produced an element.
|
||||
///
|
||||
/// - Parameter input: The published element.
|
||||
/// - Returns: A `Demand` instance indicating how many more elements the subcriber
|
||||
/// - Returns: A `Demand` instance indicating how many more elements the subscriber
|
||||
/// expects to receive.
|
||||
func receive(_ input: Input) -> Subscribers.Demand
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/// A protocol representing the connection of a subscriber to a publisher.
|
||||
///
|
||||
/// Subcriptions are class constrained because a `Subscription` has identity -
|
||||
/// Subscriptions are class constrained because a `Subscription` has identity -
|
||||
/// defined by the moment in time a particular subscriber attached to a publisher.
|
||||
/// Canceling a `Subscription` must be thread-safe.
|
||||
///
|
||||
|
||||
@@ -166,7 +166,7 @@ extension DispatchQueue {
|
||||
// as possible.
|
||||
//
|
||||
// By trial and error I got that the `rawValue` of `UInt64.max / 13`
|
||||
// gives us propably the widest range of supported values:
|
||||
// gives us probably the widest range of supported values:
|
||||
// from `Int.min / 6.5` to `Int.max / 2.889` nanoseconds.
|
||||
// That's with Int being 64 bits. Since here only UInt64 can overflow,
|
||||
// when Int is 32 bits, we don't have this issue.
|
||||
@@ -384,7 +384,7 @@ extension DispatchQueue: OpenCombine.Scheduler {
|
||||
}
|
||||
#endif
|
||||
|
||||
// This function is taken from swift-corlibs-libdispatch:
|
||||
// This function is taken from swift-corelibs-libdispatch:
|
||||
// https://github.com/apple/swift-corelibs-libdispatch/blob/c992dacf3ca114806e6ac9ffc9113b19255be9fe/src/swift/Time.swift#L134-L144
|
||||
//
|
||||
// Returns m1 * m2, clamped to the range [Int.min, Int.max].
|
||||
|
||||
@@ -44,7 +44,7 @@ extension NotificationCenter {
|
||||
/// The name of notifications published by this publisher.
|
||||
public let name: Notification.Name
|
||||
|
||||
/// The object posting the named notfication.
|
||||
/// The object posting the named notification.
|
||||
public let object: AnyObject?
|
||||
|
||||
/// Creates a publisher that emits events when broadcasting notifications.
|
||||
@@ -52,7 +52,7 @@ extension NotificationCenter {
|
||||
/// - Parameters:
|
||||
/// - center: The notification center to publish notifications for.
|
||||
/// - name: The name of the notification to publish.
|
||||
/// - object: The object posting the named notfication. If `nil`,
|
||||
/// - object: The object posting the named notification. If `nil`,
|
||||
/// the publisher emits elements for any object producing a notification
|
||||
/// with the given name.
|
||||
public init(center: NotificationCenter,
|
||||
@@ -78,7 +78,7 @@ extension NotificationCenter {
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - name: The name of the notification to publish.
|
||||
/// - object: The object posting the named notfication. If `nil`, the publisher
|
||||
/// - object: The object posting the named notification. If `nil`, the publisher
|
||||
/// emits elements for any object producing a notification with the given
|
||||
/// name.
|
||||
/// - Returns: A publisher that emits events when broadcasting notifications.
|
||||
@@ -116,7 +116,7 @@ extension NotificationCenter {
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - name: The name of the notification to publish.
|
||||
/// - object: The object posting the named notfication. If `nil`, the publisher
|
||||
/// - object: The object posting the named notification. If `nil`, the publisher
|
||||
/// emits elements for any object producing a notification with the given name.
|
||||
/// - Returns: A publisher that emits events when broadcasting notifications.
|
||||
public func publisher(for name: Notification.Name,
|
||||
|
||||
@@ -187,7 +187,9 @@ extension OperationQueue {
|
||||
}
|
||||
|
||||
private func becomeReady() {
|
||||
#if canImport(Darwin)
|
||||
// Smart key paths don't work with NSOperation in swift-corelibs-foundation prior to
|
||||
// Swift 5.1.
|
||||
#if canImport(Darwin) || swift(<5.1)
|
||||
// The smart key paths don't work with NSOperation on OS versions prior to
|
||||
// iOS 11. The string key paths work fine everywhere.
|
||||
// https://forums.swift.org/t/keypath-translation-for-kvo-notification-seems-to-not-work-properly-on-ios-10/15898
|
||||
@@ -198,7 +200,9 @@ extension OperationQueue {
|
||||
lock.lock()
|
||||
readyFromAfter = true
|
||||
lock.unlock()
|
||||
#if canImport(Darwin)
|
||||
// Smart key paths don't work with NSOperation in swift-corelibs-foundation prior to
|
||||
// Swift 5.1.
|
||||
#if canImport(Darwin) || swift(<5.1)
|
||||
// The smart key paths don't work with NSOperation on OS versions prior to
|
||||
// iOS 11. The string key paths work fine everywhere.
|
||||
// https://forums.swift.org/t/keypath-translation-for-kvo-notification-seems-to-not-work-properly-on-ios-10/15898
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
import Foundation
|
||||
import OpenCombine
|
||||
|
||||
// PropertyListEncoder and PropertyListDecoder are unavailable in
|
||||
// swift-corelibs-foundation prior to Swift 5.1.
|
||||
#if canImport(Darwin) || swift(>=5.1)
|
||||
extension PropertyListEncoder: TopLevelEncoder {
|
||||
public typealias Output = Data
|
||||
}
|
||||
@@ -15,3 +18,4 @@ extension PropertyListEncoder: TopLevelEncoder {
|
||||
extension PropertyListDecoder: TopLevelDecoder {
|
||||
public typealias Input = Data
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -337,11 +337,17 @@ extension RunLoop.Mode {
|
||||
return CFRunLoopMode(rawValue as CFString)
|
||||
#else
|
||||
return rawValue.withCString {
|
||||
CFStringCreateWithCString(
|
||||
nil,
|
||||
$0,
|
||||
CFStringEncoding(kCFStringEncodingUTF8)
|
||||
)
|
||||
#if swift(>=5.3)
|
||||
let encoding = CFStringBuiltInEncodings.UTF8.rawValue
|
||||
#else
|
||||
let encoding = CFStringEncoding(kCFStringEncodingUTF8)
|
||||
#endif // swift(>=5.3)
|
||||
|
||||
return CFStringCreateWithCString(
|
||||
nil,
|
||||
$0,
|
||||
encoding
|
||||
)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ private final class TestOperationQueue: OperationQueue {
|
||||
case addOperation(Operation)
|
||||
case addOperations([Operation], waitUntilFinished: Bool)
|
||||
case addBlockOperation(() -> Void)
|
||||
case addBarrierBloack(() -> Void)
|
||||
case addBarrierBlock(() -> Void)
|
||||
case getMaxConcurrentOperationCount
|
||||
case setMaxConcurrentOperationCount(Int)
|
||||
case getIsSuspended
|
||||
@@ -367,7 +367,7 @@ private final class TestOperationQueue: OperationQueue {
|
||||
#if swift(>=5.1)
|
||||
@available(macOS 10.15, iOS 13.0, *)
|
||||
override func addBarrierBlock(_ barrier: @escaping () -> Void) {
|
||||
history.append(.addBarrierBloack(barrier))
|
||||
history.append(.addBarrierBlock(barrier))
|
||||
super.addBarrierBlock(barrier)
|
||||
}
|
||||
#endif // swift(>=5.1)
|
||||
|
||||
@@ -587,7 +587,7 @@ private final class TestURLSessionDataTask: URLSessionDataTask {
|
||||
#if canImport(Darwin)
|
||||
return super.earliestBeginDate
|
||||
#else
|
||||
return nil // Deprecated in swift-corerlibs-foundation
|
||||
return nil // Deprecated in swift-corelibs-foundation
|
||||
#endif
|
||||
}
|
||||
set {
|
||||
|
||||
@@ -58,7 +58,7 @@ extension XCTest {
|
||||
environment[childProcessEnvVariable] = childProcessEnvVariableOnValue
|
||||
childProcess.environment = environment
|
||||
|
||||
func printDiagostics() {
|
||||
func printDiagnostics() {
|
||||
print("Parent process invocation:")
|
||||
print(ProcessInfo.processInfo.arguments.joined(separator: " "))
|
||||
print("Child process invocation:")
|
||||
@@ -73,13 +73,13 @@ extension XCTest {
|
||||
childProcess.waitUntilExit()
|
||||
if childProcess.terminationReason != .uncaughtSignal {
|
||||
XCTFail("Child process should have crashed: \(childProcess)")
|
||||
printDiagostics()
|
||||
printDiagnostics()
|
||||
}
|
||||
} catch {
|
||||
XCTFail("""
|
||||
Couldn't start child process for testing crash: \(childProcess) - \(error)
|
||||
""")
|
||||
printDiagostics()
|
||||
printDiagnostics()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Created by Sergej Jaskiewicz on 02.12.2019.
|
||||
//
|
||||
|
||||
/// A priproty queue based on binary min-heap.
|
||||
/// A priority queue based on binary min-heap.
|
||||
/// If two elements with the same priority are added, the element that was added
|
||||
/// earlier has will have "better" priority (i. e. it will be also extracted earlier).
|
||||
struct FairPriorityQueue<Priority: Comparable, Element> {
|
||||
|
||||
@@ -33,7 +33,7 @@ func testLifecycle<UpstreamOutput, Operator: Publisher>(
|
||||
let emptySubscriber =
|
||||
TrackingSubscriberBase<Operator.Output, Operator.Failure>(onDeinit: onDeinit)
|
||||
XCTAssertTrue(emptySubscriber.history.isEmpty,
|
||||
"Lifecycle test #1: thesubscriber's history should be empty",
|
||||
"Lifecycle test #1: the subscriber's history should be empty",
|
||||
file: file,
|
||||
line: line)
|
||||
operatorPublisher.subscribe(emptySubscriber)
|
||||
|
||||
@@ -18,14 +18,14 @@ final class BufferTests: XCTestCase {
|
||||
|
||||
func testInitialDemandWithKeepFullPrefetchStrategy() {
|
||||
testInitialDemand(
|
||||
withPrefetchStragety: .keepFull,
|
||||
withPrefetchStrategy: .keepFull,
|
||||
expectedSubscriptionHistory: [.requested(.max(42))]
|
||||
)
|
||||
}
|
||||
|
||||
func testInitialDemandWithByRequestPrefetchStrategy() {
|
||||
testInitialDemand(
|
||||
withPrefetchStragety: .byRequest,
|
||||
withPrefetchStrategy: .byRequest,
|
||||
expectedSubscriptionHistory: [.requested(.unlimited)]
|
||||
)
|
||||
}
|
||||
@@ -379,7 +379,7 @@ final class BufferTests: XCTestCase {
|
||||
// MARK: - Generic tests
|
||||
|
||||
private func testInitialDemand(
|
||||
withPrefetchStragety prefetch: Publishers.PrefetchStrategy,
|
||||
withPrefetchStrategy prefetch: Publishers.PrefetchStrategy,
|
||||
expectedSubscriptionHistory: [CustomSubscription.Event]
|
||||
) {
|
||||
let subscription = CustomSubscription()
|
||||
|
||||
@@ -29,7 +29,7 @@ final class CollectTests: XCTestCase {
|
||||
|
||||
func testtestUpstreamFinishesImmediately() {
|
||||
ReduceTests.testUpstreamFinishesImmediately(expectedSubscription: "Collect",
|
||||
expectedResult: [],
|
||||
expectedResult: [Int](),
|
||||
{ $0.collect() })
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ final class FlatMapTests: XCTestCase {
|
||||
// 1. FlatMap.Inner.receive(_ input:)
|
||||
// 2. Publisher.subscribe
|
||||
// ...
|
||||
// 3. FlatMap.Inner.ChildSubscriber.recive(subscription:)
|
||||
// 3. FlatMap.Inner.ChildSubscriber.receive(subscription:)
|
||||
// 4. subscription.request()
|
||||
// 5. Just.Inner.request()
|
||||
// 6. FlatMap.Inner.child(_:receivedValue)
|
||||
@@ -139,7 +139,7 @@ final class FlatMapTests: XCTestCase {
|
||||
flatMap.subscribe(downstreamSubscriber)
|
||||
XCTAssertEqual(upstreamPublisher.send(666), .none)
|
||||
|
||||
// Simply making it here shows that there's no dealock
|
||||
// Simply making it here shows that there's no deadlock
|
||||
}
|
||||
|
||||
func testCancelCancels() throws {
|
||||
@@ -965,9 +965,9 @@ final class FlatMapTests: XCTestCase {
|
||||
.requested(.max(1))])
|
||||
}
|
||||
|
||||
func testSendsSubcriptionDownstreamBeforeDemandUpstream() {
|
||||
func testSendsSubscriptionDownstreamBeforeDemandUpstream() {
|
||||
let sentDemandRequestUpstream = "Sent demand request upstream"
|
||||
let sentSubscriptionDownstream = "Sent subcription downstream"
|
||||
let sentSubscriptionDownstream = "Sent subscription downstream"
|
||||
var receiveOrder: [String] = []
|
||||
|
||||
let upstreamSubscription = CustomSubscription(onRequest: { _ in
|
||||
|
||||
@@ -113,7 +113,7 @@ final class IgnoreOutputTests: XCTestCase {
|
||||
.cancelled])
|
||||
}
|
||||
|
||||
func testSendsSubcriptionDownstreamBeforeDemandUpstream() {
|
||||
func testSendsSubscriptionDownstreamBeforeDemandUpstream() {
|
||||
var didReceiveSubscription = false
|
||||
let subscription = CustomSubscription()
|
||||
let publisher = CustomPublisherBase<Int, Error>(subscription: subscription)
|
||||
|
||||
@@ -210,7 +210,7 @@ final class JustTests: XCTestCase {
|
||||
XCTAssertEqual(Sut("f").first(), Sut("f"))
|
||||
}
|
||||
|
||||
func testFirstWhereOperatorSpecializtion() {
|
||||
func testFirstWhereOperatorSpecialization() {
|
||||
XCTAssertEqual(Sut<Int>(42).first { $0 != 42 }, .init(nil))
|
||||
XCTAssertEqual(Sut<Int>(-13).first { $0 != 42 }, .init(-13))
|
||||
XCTAssertEqual(Sut<Int>(1).first { $0 < 0 }, .init(nil))
|
||||
@@ -221,7 +221,7 @@ final class JustTests: XCTestCase {
|
||||
XCTAssertEqual(Sut("g").last(), Sut("g"))
|
||||
}
|
||||
|
||||
func testLastWhereOperatorSpecializtion() {
|
||||
func testLastWhereOperatorSpecialization() {
|
||||
XCTAssertEqual(Sut<Int>(42).last { $0 != 42 }, .init(nil))
|
||||
XCTAssertEqual(Sut<Int>(-13).last { $0 != 42 }, .init(-13))
|
||||
XCTAssertEqual(Sut<Int>(1).last { $0 < 0 }, .init(nil))
|
||||
|
||||
@@ -26,7 +26,7 @@ final class MapKeyPathTests: XCTestCase {
|
||||
}
|
||||
|
||||
MapTests.testEmpty(valueComparator: ==) {
|
||||
$0.map(\.doubled, \.tripled, \.quadripled)
|
||||
$0.map(\.doubled, \.tripled, \.quadrupled)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ final class MapKeyPathTests: XCTestCase {
|
||||
}
|
||||
|
||||
MapTests.testError(valueComparator: ==) {
|
||||
$0.map(\.doubled, \.tripled, \.quadripled)
|
||||
$0.map(\.doubled, \.tripled, \.quadrupled)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +54,14 @@ final class MapKeyPathTests: XCTestCase {
|
||||
{ $0.map(\.doubled, \.tripled) })
|
||||
|
||||
MapTests.testRange(valueComparator: ==,
|
||||
mapping: { ($0.doubled, $0.tripled, $0.quadripled) },
|
||||
{ $0.map(\.doubled, \.tripled, \.quadripled) })
|
||||
mapping: { ($0.doubled, $0.tripled, $0.quadrupled) },
|
||||
{ $0.map(\.doubled, \.tripled, \.quadrupled) })
|
||||
}
|
||||
|
||||
func testNoDemand() {
|
||||
MapTests.testNoDemand { $0.map(\.doubled) }
|
||||
MapTests.testNoDemand { $0.map(\.doubled, \.tripled) }
|
||||
MapTests.testNoDemand { $0.map(\.doubled, \.tripled, \.quadripled) }
|
||||
MapTests.testNoDemand { $0.map(\.doubled, \.tripled, \.quadrupled) }
|
||||
}
|
||||
|
||||
func testRequestDemandOnSubscribe() {
|
||||
@@ -74,14 +74,14 @@ final class MapKeyPathTests: XCTestCase {
|
||||
}
|
||||
|
||||
MapTests.testRequestDemandOnSubscribe {
|
||||
$0.map(\.doubled, \.tripled, \.quadripled)
|
||||
$0.map(\.doubled, \.tripled, \.quadrupled)
|
||||
}
|
||||
}
|
||||
|
||||
func testDemandOnReceive() {
|
||||
MapTests.testDemandOnReceive { $0.map(\.doubled) }
|
||||
MapTests.testDemandOnReceive { $0.map(\.doubled, \.tripled) }
|
||||
MapTests.testDemandOnReceive { $0.map(\.doubled, \.tripled, \.quadripled) }
|
||||
MapTests.testDemandOnReceive { $0.map(\.doubled, \.tripled, \.quadrupled) }
|
||||
}
|
||||
|
||||
func testCompletion() {
|
||||
@@ -94,27 +94,27 @@ final class MapKeyPathTests: XCTestCase {
|
||||
}
|
||||
|
||||
MapTests.testCompletion(valueComparator: ==) {
|
||||
$0.map(\.doubled, \.tripled, \.quadripled)
|
||||
$0.map(\.doubled, \.tripled, \.quadrupled)
|
||||
}
|
||||
}
|
||||
|
||||
func testCancel() throws {
|
||||
try MapTests.testCancel { $0.map(\.doubled) }
|
||||
try MapTests.testCancel { $0.map(\.doubled, \.tripled) }
|
||||
try MapTests.testCancel { $0.map(\.doubled, \.tripled, \.quadripled) }
|
||||
try MapTests.testCancel { $0.map(\.doubled, \.tripled, \.quadrupled) }
|
||||
}
|
||||
|
||||
func testCancelAlreadyCancelled() throws {
|
||||
try MapTests.testCancelAldreadyCancelled {
|
||||
try MapTests.testCancelAlreadyCancelled {
|
||||
$0.map(\.doubled)
|
||||
}
|
||||
|
||||
try MapTests.testCancelAldreadyCancelled {
|
||||
try MapTests.testCancelAlreadyCancelled {
|
||||
$0.map(\.doubled, \.tripled)
|
||||
}
|
||||
|
||||
try MapTests.testCancelAldreadyCancelled {
|
||||
$0.map(\.doubled, \.tripled, \.quadripled)
|
||||
try MapTests.testCancelAlreadyCancelled {
|
||||
$0.map(\.doubled, \.tripled, \.quadrupled)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ final class MapKeyPathTests: XCTestCase {
|
||||
),
|
||||
playgroundDescription: "ValueForKeys",
|
||||
subscriberIsAlsoSubscription: false,
|
||||
{ $0.map(\.doubled, \.tripled, \.quadripled) })
|
||||
{ $0.map(\.doubled, \.tripled, \.quadrupled) })
|
||||
}
|
||||
|
||||
func testMapKeyPathReceiveValueBeforeSubscription() {
|
||||
@@ -169,7 +169,7 @@ final class MapKeyPathTests: XCTestCase {
|
||||
expected: .history([.value((0, 0, 0))],
|
||||
demand: .max(42),
|
||||
comparator: ==),
|
||||
{ $0.map(\.doubled, \.tripled, \.quadripled) })
|
||||
{ $0.map(\.doubled, \.tripled, \.quadrupled) })
|
||||
}
|
||||
|
||||
func testMapKeyPathReceiveCompletionBeforeSubscription() {
|
||||
@@ -188,7 +188,7 @@ final class MapKeyPathTests: XCTestCase {
|
||||
testReceiveCompletionBeforeSubscription(
|
||||
inputType: Int.self,
|
||||
expected: .history([.completion(.finished)], comparator: ==),
|
||||
{ $0.map(\.doubled, \.tripled, \.quadripled) }
|
||||
{ $0.map(\.doubled, \.tripled, \.quadrupled) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ final class MapKeyPathTests: XCTestCase {
|
||||
}
|
||||
|
||||
try testLifecycle(sendValue: 31, cancellingSubscriptionReleasesSubscriber: true) {
|
||||
$0.map(\.doubled, \.tripled, \.quadripled)
|
||||
$0.map(\.doubled, \.tripled, \.quadrupled)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,5 +212,5 @@ extension Int {
|
||||
|
||||
fileprivate var tripled: Int { return self * 3 }
|
||||
|
||||
fileprivate var quadripled: Int { return self * 4 }
|
||||
fileprivate var quadrupled: Int { return self * 4 }
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ final class MapTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testMapCancelAlreadyCancelled() throws {
|
||||
try MapTests.testCancelAldreadyCancelled { $0.map { $0 * 2 } }
|
||||
try MapTests.testCancelAlreadyCancelled { $0.map { $0 * 2 } }
|
||||
}
|
||||
|
||||
func testTryMapCancelAlreadyCancelled() throws {
|
||||
@@ -608,7 +608,7 @@ final class MapTests: XCTestCase {
|
||||
line: line)
|
||||
}
|
||||
|
||||
static func testCancelAldreadyCancelled<Map: Publisher>(
|
||||
static func testCancelAlreadyCancelled<Map: Publisher>(
|
||||
file: StaticString = #file,
|
||||
line: UInt = #line,
|
||||
_ map: (CustomPublisher) -> Map
|
||||
|
||||
@@ -173,7 +173,7 @@ final class OptionalPublisherTests: XCTestCase {
|
||||
"comparator should not be called for removeDuplicates(by:)")
|
||||
}
|
||||
|
||||
func testAllSatifyOperatorSpecialization() {
|
||||
func testAllSatisfyOperatorSpecialization() {
|
||||
|
||||
var count = 0
|
||||
let predicate: (Int) -> Bool = { count += 1; return $0 > 0 }
|
||||
@@ -218,7 +218,7 @@ final class OptionalPublisherTests: XCTestCase {
|
||||
XCTAssertEqual(Sut<Int>(nil).first(), Sut(nil))
|
||||
}
|
||||
|
||||
func testFirstWhereOperatorSpecializtion() {
|
||||
func testFirstWhereOperatorSpecialization() {
|
||||
var count = 0
|
||||
let predicate: (Int) -> Bool = { count += 1; return $0 == 42 }
|
||||
|
||||
@@ -234,7 +234,7 @@ final class OptionalPublisherTests: XCTestCase {
|
||||
XCTAssertEqual(Sut<Int>(nil).last(), Sut(nil))
|
||||
}
|
||||
|
||||
func testLastWhereOperatorSpecializtion() {
|
||||
func testLastWhereOperatorSpecialization() {
|
||||
var count = 0
|
||||
let predicate: (Int) -> Bool = { count += 1; return $0 == 42 }
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ final class ReduceTests: XCTestCase {
|
||||
{ $0.tryReduce(1, *) })
|
||||
}
|
||||
|
||||
func testTryReduceFailureBecausOfThrow() throws {
|
||||
func testTryReduceFailureBecauseOfThrow() throws {
|
||||
|
||||
func reducer(_ accumulator: Int, _ newValue: Int) throws -> Int {
|
||||
if newValue == 5 {
|
||||
|
||||
@@ -278,7 +278,7 @@ final class ResultPublisherTests: XCTestCase {
|
||||
XCTAssertEqual(count, 2)
|
||||
}
|
||||
|
||||
func testAllSatifyOperatorSpecialization() {
|
||||
func testAllSatisfyOperatorSpecialization() {
|
||||
var count = 0
|
||||
let predicate: (Int) -> Bool = { count += 1; return $0 > 0 }
|
||||
XCTAssertEqual(Sut<Int>(0).allSatisfy(predicate).result, .success(false))
|
||||
@@ -288,7 +288,7 @@ final class ResultPublisherTests: XCTestCase {
|
||||
XCTAssertEqual(count, 2)
|
||||
}
|
||||
|
||||
func testTryAllSatifyOperatorSpecialization() {
|
||||
func testTryAllSatisfyOperatorSpecialization() {
|
||||
var count = 0
|
||||
let predicate: (Int) -> Bool = { count += 1; return $0 > 0 }
|
||||
let throwingPredicate: (Int) throws -> Bool = { _ in
|
||||
|
||||
@@ -362,7 +362,7 @@ final class SequenceTests: XCTestCase {
|
||||
)
|
||||
}
|
||||
|
||||
func testFirstWhereOperatorSpecializtion() {
|
||||
func testFirstWhereOperatorSpecialization() {
|
||||
XCTAssertEqual(makePublisher(1 ..< 9).first { $0.isMultiple(of: 4) }, .init(4))
|
||||
XCTAssertEqual(makePublisher(1 ..< 9).first { $0.isMultiple(of: 13) }, .init(nil))
|
||||
XCTAssertEqual(
|
||||
@@ -531,7 +531,7 @@ final class SequenceTests: XCTestCase {
|
||||
XCTAssertEqual(makePublisher(EmptyCollection<Int>()).last(), .init(nil))
|
||||
}
|
||||
|
||||
func testLastWhereOperatorSpecializtion() {
|
||||
func testLastWhereOperatorSpecialization() {
|
||||
XCTAssertEqual(makePublisher(1 ..< 9).last { $0.isMultiple(of: 4) }, .init(8))
|
||||
XCTAssertEqual(makePublisher(1 ..< 9).last { $0.isMultiple(of: 13) }, .init(nil))
|
||||
XCTAssertEqual(
|
||||
@@ -540,7 +540,7 @@ final class SequenceTests: XCTestCase {
|
||||
)
|
||||
}
|
||||
|
||||
func testPrependVariadicOperatorSpezialization() {
|
||||
func testPrependVariadicOperatorSpecialization() {
|
||||
let baseCollection = TrackingCollection<Int>([4, 5, 6, 7])
|
||||
|
||||
XCTAssertEqual(baseCollection.history, [.initFromSequence])
|
||||
@@ -613,7 +613,7 @@ final class SequenceTests: XCTestCase {
|
||||
XCTAssertEqual(newCollection.history, [.initFromSequence, .appendSequence])
|
||||
}
|
||||
|
||||
func testAppendVariadicOperatorSpezialization() {
|
||||
func testAppendVariadicOperatorSpecialization() {
|
||||
let baseCollection = TrackingCollection<Int>([1, 2, 3])
|
||||
|
||||
XCTAssertEqual(baseCollection.history, [.initFromSequence])
|
||||
|
||||
@@ -23,7 +23,7 @@ final class CompletionTests: XCTestCase {
|
||||
let encoder = TrackingEncoder()
|
||||
let decoder = JSONDecoder()
|
||||
|
||||
func testDecodingFinised() throws {
|
||||
func testDecodingFinished() throws {
|
||||
let successJSON = #"{"success":true}"#
|
||||
let illFormedSuccessJSON = #"{"error":{"description":"oops"},"success":true}"#
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ final class VirtualTimeSchedulerTests: XCTestCase {
|
||||
.now])
|
||||
}
|
||||
|
||||
func testRepeadedAction() {
|
||||
func testRepeatedAction() {
|
||||
let scheduler = VirtualTimeScheduler()
|
||||
var history = [Int]()
|
||||
let cancellable = scheduler.schedule(after: scheduler.now + .microseconds(2),
|
||||
|
||||
Reference in New Issue
Block a user