-
Notifications
You must be signed in to change notification settings - Fork 155
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
Consider implementing Testable for Option<bool> #105
Comments
I personally kind of like writing |
I think |
This would be nice for use with the
|
Has this been reconsidered? I'd be happy to submit a PR. The more ideal solution would probably be to implement the |
I remain unconvinced that this is worth doing. I'd rather see tests being explicitly discarded. |
Types like the one drafted in #281 (whether they are part of this library or implemented on the user's side) create use-cases where returning an fn revrev(original: u128) -> Option<Equivalence<u128>> {
if original == u128::MAX {
// for some reason, u128::MAX must be ignored for the test
None
} else {
// pseudo idendity
Some(Equivalence::of(xs, revrev))
}
} Without an fn revrev(original: u128) -> TestResult {
if original == u128::MAX {
// for some reason, u128::MAX must be ignored for the test
TestResult::discard()
} else {
// pseudo idendity
Equivalence::of(xs, revrev).into_result(Gen::new(0))
}
} ... with the very unsightly Of course, discarding a test/value explicitly would be far more expressive. And I myself am not sure whether using an |
It seems like
Option<bool>
would be a simple way to discard tests vs. having to return aTestResult
directly.The text was updated successfully, but these errors were encountered: