Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prototype for producing an Observable with a marble diagram #19

Closed
wants to merge 1 commit into from

Conversation

jmfayard
Copy link

@jmfayard jmfayard commented Feb 4, 2018

val o: Observable<String> = rxmarble(
     "--1---3-|", scheduler, tick,
     listOf("2", "4", "9")
)

The marble diagram describes when things are emitted, the list is a mapping that describes what is emitted for a given index (starting at 1). If you use a mapping of type List<T> you get an Observable<T>. Alternatively you can pass a lambda.

In this case, the observable

wait 30 ms,
produce "2" (first element of the list)
wait 45ms,
produce "9" (third element of the list),
wait 15ms,
complete

Inspired by https://github.com/ReactiveX/rxjs/blob/master/doc/writing-marble-tests.md

API: instable
Bugs: a lot
Missing features: a lot

val list = listOf(2, 4, 9)
rxmarble("--1---3-|", scheduler, tick,list)

===> wait 30 ms, produce 4 (first element of the list)
wait 45ms, produce 9 (third element of the list), wait 15ms,
complete

Inspired by https://github.com/ReactiveX/rxjs/blob/master/doc/writing-marble-tests.md

API: instable
Bugs: a lot
Missing features: a lot
@jmfayard jmfayard mentioned this pull request Feb 4, 2018
@jmfayard jmfayard closed this Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant