-
Notifications
You must be signed in to change notification settings - Fork 214
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
Change expectations which take no arguments to be getters - check(foo).isTrue
instead of check(foo).isTrue()
#1943
Comments
I wonder if there should be a general "unused function tearoff" lint? cc @pq |
Ah. This is very interesting. The Some back ground in dart-lang/sdk#58084 and dart-lang/sdk#36653. |
We are using You could try enabling the |
Ah, this is good (for the |
I don't thinks it's been discussed for There has been internal discussion and an interest in adopting the lint, but with the progress stalled out on a way to suppress the lint for false positives, I don't think we have it enabled. I'll close this issue since I think there isn't anything to do here, and we can track the reccommendation on the other repo. |
Just before we close this issue down altogether, can we briefly reconsider whether the right choice is a property or a method for these simple I think the user confusion here is that the obvious analog for |
It would reduce them, but not eliminate them. A quick note on design priorities - consistency in naming, arguments, or behavior with On the specific topic of using I can reopen this issue to see if there is further support for changing to getters. |
check(foo).isTrue
instead of check(foo).isTrue()
Thanks so much, Nate! This is where I think we're not aligned: "consistency in naming, arguments, or behavior with matcher to ease the migration is a vastly lower priority than the ergonomics of writing new tests going forward". We've reached a point in the product lifecycle where this kind of change is much more costly to the ecosystem than it was a few years ago. It may yet be true that 90% of the apps to be written with Flutter haven't been started, but there is still a LOT of code out there today. We have two choices:
|
I accidentally changed:
expect(foo, isNotNull);
to:
check(foo).isNotNull;
(instead of
check(foo).isNotNull();
)This compiles and gives no warning, but of course does not actually execute the test.
Is there a way we can detect this kind of user failure?
The text was updated successfully, but these errors were encountered: