-
Couldn't load subscription status.
- Fork 1.4k
#1647 - Converted ZIOSpecJvm #2206
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! Way to rip through in a day something that had been hanging out there for months! Couple of comments below but looks great.
| @@ -1,767 +1,643 @@ | |||
| package zio | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this to the shared folder so these tests run on both the JVM and ScalaJS. It doesn't look like any of them involve blocking effects that wouldn't be available cross-platform. I think it was just labeled this way for historical reasons because not all of the tests had been migrated previously. Ideally we would make these tests part of the existing ZIOSpec.scala file though we may need to split it if the file length gets too long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's a good way to merge it into ZIOSpec.
Right now, it's just a pile of tests with very little grouping by topic/area.
Just dumping everything at end, doesn't sound like a great idea :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be a separate issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were originally part of the same file and then got split up in #1947 when some of the tests were migrated, so maybe we can organize it similarly to the original version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but can we merge this PR and first?
Because I keep seeing changes to ZIOSpecJvm in master...
BTW, I'm not sure how to do what you did in #2210 in ZTest.
(or do I need to change anything? I'm not getting TestClock warnings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Let's get this merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you resolve the merge conflict? I think you can just use the TestClock in the environment.
| case (((a, b), c), d) => f(a, b, c, d) | ||
| } | ||
|
|
||
| implicit class ZioOfTestResultOps[R, E](val res: ZIO[R, E, TestResult]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we take this out? We have an open issue for the same problem you're dealing with in #1888 and do want to do something about it, but if we do something want to support all the operators and do so in a way that works for all combinations of assert and assertM. Not sure if implicit syntax is the right way to do this. If we make assertions effectual as I am working on in #2182 this problem will solve itself. In the meantime you can do something like:
for {
partial <- assertM(partialParse, succeeds(equalTo(List.empty[Int])))
full <- assertM(fullParse, succeeds(equalTo(List(123, 4))))
} yield partial && full for {
partial <- partialParse
full <- fullParse
} yield assert(partial, succeeds(equalTo(List.empty[Int]))) &&
assert(full, succeeds(equalTo(List(123, 4))))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used this operator a lot in this test, so I moved it into the helper object for the Spec, for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
b478e0c to
4a951f4
Compare
|
Doesn't ZTest have TestClock in the environment by default?
…On Mon, Nov 11, 2019, 5:58 PM Adam Fraser ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In core-tests/jvm/src/test/scala/zio/ZIOSpecJvm.scala
<#2206 (comment)>:
> @@ -1,767 +1,643 @@
package zio
Can you resolve the merge conflict? I think you can just use the TestClock
in the environment.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2206?email_source=notifications&email_token=AAMBETYREV6BL7JBCYNOI5LQTF6IPA5CNFSM4JLNUG7KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCLDFZMQ#discussion_r344780274>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMBET32DHKZY3DGHDJ4TBLQTF6IPANCNFSM4JLNUG7A>
.
|
|
Yes, you shouldn't have to create it anymore. |
4a951f4 to
acce0b6
Compare
t5: For f: Int => String: `IO.bimap(f, identity)` maps an IO[Int, String] into an IO[String, String]
…String] as `IO.flatten` does
…Either[E, String]] as `IO.absolve` does
… due to referential transparency
Check `zipPar` method does not report failure when interrupting loser after it succeeded;
…t merged to master
acce0b6 to
f47d19a
Compare
* t1: IO.foreach` returns the list of results * t2: IO.foreach` both evaluates effects and returns the list of Ints in the same order * t3: `IO.foreach` fails with a NumberFormatException exception * t4: `IO.foreachPar` returns the list of Ints in the same order t5: For f: Int => String: `IO.bimap(f, identity)` maps an IO[Int, String] into an IO[String, String] * t6: IO.collectAllPar` returns the list in the same order * t7: `IO.forkAll` returns the list of Ints in the same order * t8: `IO.collectAllParN` returns the list of Ints in the same order * t9: `IO.foreachParN` returns the list of created Strings in the appropriate order * t10: `IO.foldLeft` with a successful step function sums the list properly * t11: `IO.foldLeft` with a failing step function returns a failed IO * Check done lifts exit result into IO * Check `catchSomeCause` catches matching cause * Check `catchSomeCause` halts if cause doesn't match * Check `when` executes correct branch only * scalafmt * Check `whenM` executes condition effect and correct branch * Check `whenCase` executes correct branch only * Check `whenCaseM` executes condition effect and correct branch * Check `unsandbox` unwraps exception * Check `supervise` returns same value as IO.supervise * Check `flatten` method on IO[E, IO[E, String] returns the same IO[E, String] as `IO.flatten` does * Check `absolve` method on IO[E, Either[E, A]] returns the same IO[E, Either[E, String]] as `IO.absolve` does * Check non-`memoize`d IO[E, A] returns new instances on repeated calls due to referential transparency * Check `cached` method on IO[E, A] returns new instances after duration * Check `raceAll` method returns the same IO[E, A] as `IO.raceAll` does * Check `firstSuccessOf` method returns the same IO[E, A] as `IO.firstSuccessOf` does * Check `zipPar` method does not swallow exit causes of loser; Check `zipPar` method does not report failure when interrupting loser after it succeeded; * Check `orElse` method does not recover from defects * Check `eventually` method succeeds eventually * implemented a large chunk of tests * converted the rest of the tests * Minor changes requested in PR review * implemented "Check `summarized` returns summary and value", which just merged to master * porting changes to ZIOSpecJvm from zio#2169
#1647