-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Fix self-comparison and assert typos in TestSemantics #185975
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -508,7 +508,7 @@ class TestSemantics { | |||||||||||||
| ); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (controlsNodes != controlsNodes && !setEquals(controlsNodes, node.controlsNodes)) { | ||||||||||||||
| if (controlsNodes != null && !setEquals(controlsNodes, node.controlsNodes)) { | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also apply these changes in |
||||||||||||||
| return fail( | ||||||||||||||
| 'expected node id $id to controls nodes $controlsNodes but found controlling nodes ${node.controlsNodes}', | ||||||||||||||
| ); | ||||||||||||||
|
|
@@ -715,7 +715,7 @@ class SemanticsTester { | |||||||||||||
| if (first[i] is LocaleStringAttribute && | ||||||||||||||
| (second[i] is! LocaleStringAttribute || | ||||||||||||||
| second[i].range != first[i].range || | ||||||||||||||
| (second[i] as LocaleStringAttribute).locale != | ||||||||||||||
| (first[i] as LocaleStringAttribute).locale != | ||||||||||||||
| (second[i] as LocaleStringAttribute).locale)) { | ||||||||||||||
| return false; | ||||||||||||||
| } | ||||||||||||||
|
|
@@ -1180,8 +1180,14 @@ class _IncludesNodeWith extends Matcher { | |||||||||||||
| scrollExtentMin != null || | ||||||||||||||
| maxValueLength != null || | ||||||||||||||
| currentValueLength != null || | ||||||||||||||
| inputType != null, | ||||||||||||||
| minValue != null || maxValue != null, | ||||||||||||||
| inputType != null || | ||||||||||||||
| minValue != null || | ||||||||||||||
| maxValue != null, | ||||||||||||||
|
Comment on lines
+1183
to
+1185
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two points to consider regarding this change:
Suggested change
References
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the bot is correct. There should have a message for the assertion failure. Developer should be notified what's wrong. |
||||||||||||||
| 'At least one matcher field must be non-null so the matcher checks for at least one ' | ||||||||||||||
| 'property of a semantics node. Pass any of `label`, `value`, `actions`, `flags`, ' | ||||||||||||||
| '`flagsCollection`, `tags`, `increasedValue`, `decreasedValue`, `scrollPosition`, ' | ||||||||||||||
| '`scrollExtentMax`, `scrollExtentMin`, `maxValueLength`, `currentValueLength`, ' | ||||||||||||||
| '`inputType`, `minValue`, or `maxValue`.', | ||||||||||||||
| ); | ||||||||||||||
| final AttributedString? attributedLabel; | ||||||||||||||
| final AttributedString? attributedValue; | ||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
Hi @Sanaullah49 , I'm not from the flutter team. But I've talk about this change. I think, we should not do null check here. Let me help you understand why not.
what do you expect? the controlsNodes are not same, so the test shouldnot pass, right?
when you run test for this case. according to your code, the left side will be false, consequently, the test will pass event the
contrlNodesare not same.I suggest you to fix it
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.
The intention is to make this an optional matcher, if not provided, it won't check againt the field. I think this is fine as is since this matcher is already quite noisy and deprecated, we shouldn't make it more noisy