-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 support for comparing related types in assertTrue in Scala 2 #8875
Conversation
for { | ||
result <- resultZIO | ||
} yield assertTrue(result.is(_.left).contains("type mismatch")) | ||
} @@ scala2Only, | ||
test("comparison compiles when comparing different types") { |
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 mark this one as 'primitive' as well?
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.
Fixed - after this is merged I can add more tests related to comparing - comparing unrelated classes, comparing related classes etc. - I believe currently behaviour is a bit undefined there.
for { | ||
result <- resultZIO | ||
} yield assertTrue(result.is(_.left).contains("type mismatch")) | ||
} @@ scala2Only, |
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.
Will this not fail with 'type mismatch' on Scala 3?
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.
Nope:
- SmartAssertionSpec / equalTo does not compile when comparing unrelated types in Scala 2 - 26 ms
? Either was Right
result.is(_.left).contains("type mismatch")
result = Right(value = ())
at D:\MojeProgramy\zio\test-tests\shared\src\test\scala\zio\test\SmartAssertionSpec.scala:227
but it does not work correctly (at least the diffing part): #8754
@andrzejressel Would like to get this in. Please re-open when CI is passing! 🙏 |
Fixes #8874