Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@er1c
Copy link
Contributor

@er1c er1c commented Jun 25, 2020

Resolves #3873

Is there a good way to create tests for this?

@simpadjo
Copy link
Contributor

Good addition!
I see that implementation is inspired by .toIterator. Maybe it is possible to just wrap Iterator[Char] into a Reader and piggy-back .toIterator?

Regarding tests, you can take a look at how ZStream.toIterator is tested.

@er1c
Copy link
Contributor Author

er1c commented Jun 25, 2020

@simpadjo took the implementation patterns from ZInputStream I'll look into the toIterator tests (where are these these tests?), thanks!

semi-related, what's the special sbt foo to run the code formatter check locally?

sbt fmt

@er1c er1c force-pushed the stream-reader branch 2 times, most recently from 10b5df8 to e23fd2d Compare June 25, 2020 14:49
@simpadjo
Copy link
Contributor

Yes, probably Reader has more capabilities than Iterator, so makes sense to implement it like that.
Then you could look at ZStream.toInputStream tests: https://github.com/zio/zio/blob/master/streams-tests/shared/src/test/scala/zio/stream/ZStreamSpec.scala#L2706

@simpadjo
Copy link
Contributor

The best way to format the code is sbt prepare (see Contributors Guide).

@er1c
Copy link
Contributor Author

er1c commented Jun 26, 2020

Just found the toInputStream tests:

adding it here for my reference.

@er1c er1c force-pushed the stream-reader branch 12 times, most recently from abf5629 to 9d77675 Compare June 26, 2020 05:57
@er1c
Copy link
Contributor Author

er1c commented Jun 26, 2020

Tests added

@er1c er1c marked this pull request as ready for review June 26, 2020 05:59
@er1c er1c requested a review from iravid as a code owner June 26, 2020 05:59
@er1c er1c force-pushed the stream-reader branch 2 times, most recently from 282d677 to 300965c Compare June 26, 2020 06:03
Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you @er1c, awesome contribution :-)

@iravid iravid merged commit 2ff9358 into zio:master Jun 26, 2020
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.

Add ZStream.toReader

3 participants