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

Resource.asFlow #2677

Merged
merged 4 commits into from Mar 2, 2022
Merged

Resource.asFlow #2677

merged 4 commits into from Mar 2, 2022

Conversation

i-walker
Copy link
Member

@i-walker i-walker commented Mar 2, 2022

resolves #2632

@i-walker i-walker requested a review from a team March 2, 2022 08:25
checkAll(Arb.int()) { n ->
val r = Resource({ n }, { _, _ -> Unit })

r.asFlow().map { it + 1 } shouldBe flowOf(n + 1)
Copy link
Member

@nomisRev nomisRev Mar 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be failing but it passed on Windows 🤔
You cannot compare Flow since they are deferred values, they should be run and calculate a result before you can compare them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree :) I checked in Kotest and I couldn't find an Matcher for flow, that was the only idea I had why this would pass

i-walker and others added 3 commits March 2, 2022 09:48
…fx/coroutines/Resource.kt

Co-authored-by: Simon Vergauwen <nomisRev@users.noreply.github.com>
@nomisRev nomisRev merged commit 08e9978 into main Mar 2, 2022
@nomisRev nomisRev deleted the is-resourceAsFlow branch March 2, 2022 10:34
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.

["Request"] Convenience conversion from Resource<R> to Flow<R>
2 participants