         }
     #endif
 }
+
+// MARK: TakeUntil Predicate Tests
+extension ObservableTakeUntilTest {
+    func testTakeUntilPredicate_Preempt_SomeData_Next() {
+        let scheduler = TestScheduler(initialClock: 0)
+
+        let l = scheduler.createHotObservable([
+            .next(150, 1),
+            .next(210, 2),
+            .next(220, 3),
+            .next(230, 4),
+            .next(240, 5),
+            .completed(250)
+            ])
+
+        let res = scheduler.start {
+            l.takeUntil { $0 == 4 }
+        }
+
+        XCTAssertEqual(res.events, [
+            .next(210, 2),
+            .next(220, 3),
+            .completed(230)
+            ])
+
+        XCTAssertEqual(l.subscriptions, [
+            Subscription(200, 230)
+        ])
+    }
+
+    func testTakeUntilPredicate_Preempt_SomeData_Error() {
+        let scheduler = TestScheduler(initialClock: 0)
+
+        let l = scheduler.createHotObservable([
+            .next(150, 1),
+            .next(210, 2),
+            .next(220, 3),
+            .error(225, testError)
+        ])
+
+        let res = scheduler.start {
+            l.takeUntil { $0 == 4 }
+        }
+
+        XCTAssertEqual(res.events, [
+            .next(210, 2),
+            .next(220, 3),
+            .error(225, testError)
+        ])
+
+        XCTAssertEqual(l.subscriptions, [
+            Subscription(200, 225)
+        ])
+    }
+
+    func testTakeUntilPredicate_AlwaysFailingPredicate() {
+        let scheduler = TestScheduler(initialClock: 0)
+
+        let l = scheduler.createHotObservable([
+            .next(150, 1),
+            .next(210, 2),
+            .next(220, 3),
+            .next(230, 4),
+            .next(240, 5),
+            .completed(250)
+        ])
+
+        let res = scheduler.start {
+            l.takeUntil { _ in false }
+        }
+
+        XCTAssertEqual(res.events, [
+            .next(210, 2),
+            .next(220, 3),
+            .next(230, 4),
+            .next(240, 5),
+            .completed(250)
+        ])
+
+        XCTAssertEqual(l.subscriptions, [
+            Subscription(200, 250)
+        ])
+    }
+
+    func testTakeUntilPredicate_ImmediatelySuccessfulPredicate() {
+        let scheduler = TestScheduler(initialClock: 0)
+
+        let l = scheduler.createHotObservable([
+            .next(150, 1),
+            .next(210, 2),
+            .next(220, 3),
+            .next(230, 4),
+            .next(240, 5),
+            .completed(250)
+        ])
+
+        let res = scheduler.start {
+            l.takeUntil { _ in true }
+        }
+
+        XCTAssertEqual(res.events, [
+            .completed(210)
+        ])
+
+        XCTAssertEqual(l.subscriptions, [
+            Subscription(200, 210)
+        ])
+    }
+}

            ])
    }
    
    func testTakeUntil_Preempt_BeforeFirstProduced_RemainSilentAndProperDisposed() {
        let scheduler = TestScheduler(initialClock: 0)
        
        let l = scheduler.createHotObservable([

        XCTAssertFalse(sourceNotDisposed)
    }
    
    func testTakeUntil_NoPreempt_AfterLastProduced_ProperlyDisposed() {
        let scheduler = TestScheduler(initialClock: 0)
        
        let l = scheduler.createHotObservable([
