-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 comments to binding gen tests for invocations on new lines #91237
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsAddresses #91218 (comment).
|
...sions.Configuration.Binder/tests/SourceGenerationTests/ConfigurationBinderTests.Generator.cs
Show resolved
Hide resolved
...soft.Extensions.Options.ConfigurationExtensions/tests/Common/ConfigurationExtensionsTests.cs
Outdated
Show resolved
Hide resolved
...sions.Configuration.Binder/tests/SourceGenerationTests/ConfigurationBinderTests.Generator.cs
Show resolved
Hide resolved
...ConfigurationExtensions/tests/SourceGenerationTests/ConfigurationExtensionsTest.Generator.cs
Show resolved
Hide resolved
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.
I added an extra suggestion, LGTM otherwise. Thanks!
[Fact] | ||
public void TestBindingInvocationsWithIrregularCSharpSyntax() | ||
{ | ||
// Tests binding invocation variants with irregular C# syntax, interspersed with white space. |
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.
Each statement through here should get the same treatment of a comment for each different variation of syntax. @tarekgh -- Or should we make each scenario its own [Fact]
to make it even more clear?
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.
I think having separate Fact method for each case will be too much especially if we'll need to add more in the future. The most important thing for me is to ensure that anyone touching this code will get a chance to see the attached comment to that line of code and understand why we wrote it this way.
@layomia / @tarekgh -- I pushed a couple commits that expand on the comments and reorganize the tests a bit. If this looks good to you, I'll also approve and we can merge. The spirit of what I changed:
@layomia In the ConfigurationExtensions tests, there were no Asserts in the test. Are asserts needed, or does a non-throwing execution indicate success? |
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.
@jeffhandley changes LGTM. Thanks!
Jeff already submitted the commits that address his comments.
Indeed non-throwing execution indicates success. The tests are really testing successful compilation. Input syntax doesn't affect the emitted binding logic, which is being tested by the other functional tests. |
Thanks Jeff & Tarek for the detailed review; and Jeff thanks for helping to improve the comments. |
* Add comments to binding gen tests for invocations on new lines * Address feedback & test static method call syntax * Reorganize and comment the newline/whitespace scenarios * Reorganize and comment the newline/whitespace scenarios for ConfigurationExtensions --------- Co-authored-by: Jeff Handley <[email protected]>
… on separate line (#91218) * Emit interceptor info correctly when invocation expr is on separate line * Add more tests and add helper to udpate baselines * Add comments to binding gen tests for invocations on new lines (#91237) * Add comments to binding gen tests for invocations on new lines * Address feedback & test static method call syntax * Reorganize and comment the newline/whitespace scenarios * Reorganize and comment the newline/whitespace scenarios for ConfigurationExtensions --------- Co-authored-by: Jeff Handley <[email protected]> * Update baselines --------- Co-authored-by: Layomi Akinrinade <[email protected]> Co-authored-by: Jeff Handley <[email protected]>
Addresses #91218 (comment).