-
Notifications
You must be signed in to change notification settings - Fork 91
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
Relax assertEquals
strictness about type equality.
#70
Conversation
Previously, `assertEquals` only allowed comparing values of the same type. Now, it's OK as long as the second argument is a subtype of the first argument. The reasoning for this change is that it's common that you want to test some generic value like `Option[Int]` obtained from a method we're testing against an expected hardcoded value like `Some[Int]`.
docs/assertions.md
Outdated
if one value is a subtype of the other. | ||
The "expected" value (second argument) must be a subtype of the "obtained" value | ||
(first argument). It's a type error to compare two values even if one value is a | ||
subtype of the other. |
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.
is it still a type error?
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.
It's not a type error, removed
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.
LGTM 👍
Users navigating to the source via IDEs can then learn about the `assertEquals[Any, Any]` escape hatch.
eb5f1ab
to
77f3264
Compare
Yay figured out the cryptic windows failures! |
Following up from an offline conversation with @gabro
Previously,
assertEquals
only allowed comparing values of the sametype. Now, it's OK as long as the second argument is a subtype of the
first argument. The reasoning for this change is that it's common that
you want to test some generic value like
Option[Int]
obtained from amethod we're testing against an expected hardcoded value like
Some[Int]
.