Skip to content

Commit fb22a73

Browse files
committed
Add tests to demonstrate bugs
1 parent 2df0bea commit fb22a73

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

rxjava-core/src/main/java/rx/operators/OperationTake.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,18 @@ public void testTake2() {
260260
verify(aObserver, times(1)).onCompleted();
261261
}
262262

263+
@Test
264+
public void testTakeDoesntLeakErrors() {
265+
Observable<String> source = Observable.concat(Observable.from("one"), Observable.<String>error(new Exception("test failed")));
266+
Observable.create(take(source, 1)).last();
267+
}
268+
269+
@Test
270+
public void testTakeZeroDoesntLeakError() {
271+
Observable<String> source = Observable.<String>error(new Exception("test failed"));
272+
Observable.create(take(source, 0)).lastOrDefault("ok");
273+
}
274+
263275
@Test
264276
public void testUnsubscribeAfterTake() {
265277
Subscription s = mock(Subscription.class);

0 commit comments

Comments
 (0)