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

Missing TestLens#cause Macro Implementation #8872

Closed
khajavi opened this issue May 18, 2024 · 0 comments · Fixed by #8876
Closed

Missing TestLens#cause Macro Implementation #8872

khajavi opened this issue May 18, 2024 · 0 comments · Fixed by #8876
Labels
bug Something isn't working

Comments

@khajavi
Copy link
Member

khajavi commented May 18, 2024

I expect the following code to compile:

test("TestLens#cause") {
  for {
    exit <- ZIO.failCause(Cause.fail("Boom!")).exit
  } yield assertTrue(exit.is(_.cause) == Cause.fail("Boom!"))
}

But fails with the following errors:

[info] compiling 4 Scala sources to /home/milad/sources/scala/zio-2.x-new/examples/jvm/target/scala-2.13/test-classes ...
[error] /home/milad/sources/scala/zio-2.x-new/examples/shared/src/test/scala/zio/examples/test/TestTest.scala:65:21: type mismatch;
[error]  found   : zio.test.TestArrow[zio.Cause[String],Boolean]
[error]  required: zio.test.TestArrow[zio.Exit[String,Nothing],?]
[error]   } yield assertTrue(exit.is(_.cause) == Cause.fail("Boom!"))

Here is a hint for anyone who wants to fix it:

  1. There is a missing case for "cause" case on parseAsAssertion
  2. Also, we need a helper method to create a TestArrow from Exit[E, A] to Cause[E] inside SmartAssertions object.
@khajavi khajavi added the bug Something isn't working label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant