diff --git a/Tests/RxSwiftTests/Observable+ConcatTests.swift b/Tests/RxSwiftTests/Observable+ConcatTests.swift index 0630fbb55..719ec138f 100644 --- a/Tests/RxSwiftTests/Observable+ConcatTests.swift +++ b/Tests/RxSwiftTests/Observable+ConcatTests.swift @@ -631,11 +631,11 @@ extension ObservableConcatTest { let elements = try! generateCollection(0) { i in Observable.just(i, scheduler: CurrentThreadScheduler.instance) } - .take(10000) + .take(100) .toBlocking() .toArray() - XCTAssertEqual(elements, Array(0 ..< 10000)) + XCTAssertEqual(elements, Array(0 ..< 100)) XCTAssertEqual(maxTailRecursiveSinkStackSize, 1) } @@ -644,12 +644,12 @@ extension ObservableConcatTest { let elements = try! generateSequence(0) { i in Observable.just(i, scheduler: CurrentThreadScheduler.instance) } - .take(10000) + .take(100) .toBlocking() .toArray() - XCTAssertEqual(elements, Array(0 ..< 10000)) - XCTAssertTrue(maxTailRecursiveSinkStackSize > 1000) + XCTAssertEqual(elements, Array(0 ..< 100)) + XCTAssertTrue(maxTailRecursiveSinkStackSize > 10) } #endif diff --git a/Tests/RxSwiftTests/TestImplementations/Mocks/PrimitiveHotObservable.swift b/Tests/RxSwiftTests/TestImplementations/Mocks/PrimitiveHotObservable.swift index 4af0c3fea..1fbfe0174 100644 --- a/Tests/RxSwiftTests/TestImplementations/Mocks/PrimitiveHotObservable.swift +++ b/Tests/RxSwiftTests/TestImplementations/Mocks/PrimitiveHotObservable.swift @@ -19,8 +19,14 @@ class PrimitiveHotObservable : ObservableType { typealias Events = Recorded typealias Observer = AnyObserver - var subscriptions = [Subscription]() - let observers = PublishSubject() + var _subscriptions = [Subscription]() + let _observers = PublishSubject() + + public var subscriptions: [Subscription] { + lock.lock() + defer { lock.unlock() } + return _subscriptions + } let lock = RecursiveLock() @@ -30,17 +36,17 @@ class PrimitiveHotObservable : ObservableType { func on(_ event: Event) { lock.lock() defer { lock.unlock() } - observers.on(event) + _observers.on(event) } func subscribe(_ observer: O) -> Disposable where O.E == E { lock.lock() defer { lock.unlock() } - let removeObserver = observers.subscribe(observer) - subscriptions.append(SubscribedToHotObservable) + let removeObserver = _observers.subscribe(observer) + _subscriptions.append(SubscribedToHotObservable) - let i = self.subscriptions.count - 1 + let i = self._subscriptions.count - 1 var count = 0 @@ -52,7 +58,7 @@ class PrimitiveHotObservable : ObservableType { count += 1 assert(count == 1) - self.subscriptions[i] = UnsunscribedFromHotObservable + self._subscriptions[i] = UnsunscribedFromHotObservable } } }