-
Notifications
You must be signed in to change notification settings - Fork 731
Format records and anonymous types with their member values #2144
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
Format records and anonymous types with their member values #2144
Conversation
0bb526f to
536b008
Compare
Pull Request Test Coverage Report for Build 4643984026Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
dennisdoomen
left a comment
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.
🤔 Would be nice to have an example of the before and after situations in the PR description
b52e40f to
5829a5f
Compare
Tests/FluentAssertions.Specs/Primitives/ReferenceTypeAssertionsSpecs.cs
Outdated
Show resolved
Hide resolved
|
Hi @dennisdoomen @lg2de, is there anything else to do for this PR? |
No, waiting for @jnyrup to find some time to review the PR as well. |
54cebd5 to
cf68b01
Compare
jnyrup
left a comment
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.
Great work.
I really liked reviewing this and how we gradually improved it one step a time.
|
@dennisdoomen Will you have another look since the implementation changed some since your approval. |
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.
❓Wouldn't it make the output better readable if we add an empty line after a multi-line "Expected..." statement? Just like we do in C#.
@benagain sorry for some of the new comments. But as @jnyrup requested, I had a bit of a more thorough look at the PR (and the output we used to generate). Very happy with the improvements. We just need to make sure it's picture perfect.
I'm not entirely sure what you mean here @dennisdoomen, is this the same as #2144 (comment)? If not, could you elaborate a little please?
No problem, I'm quite enjoying polishing it to get it right. |
Yeah, I meant the same thing there. |
a4c784f to
daf9ac3
Compare
|
@benagain I assume you're still working on this PR. Ping me when you're done and I can conclude the review. |
Hi @dennisdoomen, I found an annoying problem that has been tricky to resolve. As it currently stands a list of objects will be formatted with the list's opening brace and the first object's name on the same line as "Expected...", rather than on a new line: This comes down to the interplay between I'm fairly close to a solution but I will be the first to say it's a touch convoluted. Maybe when I show the code someone will have a better idea. |
10b3abc to
0d74c41
Compare
|
@dennisdoomen, @lg2de, @jnyrup, and anyone else interested!.. I'd like to draw your attention to the test fluentassertions/Tests/FluentAssertions.Specs/Formatting/FormatterSpecs.cs Lines 213 to 223 in 0d74c41
I think this formatting is what we're after, especially the newline after "expected stuff to be", and indentation of the type name to match the type contents. This particular I tried a few different things, then came up with Please have a look. It seems a bit overly complicated for what should be something simple but I have not yet thought of a better solution whilst keeping the desired formatting. |
|
I like what I see in the new tests! |
#2140 - Enhance the output formatter so that record, anonymous types and tuples output are displayed as their member values rather than their
ToStringimplementation.Before:
After:
IMPORTANT
If the PR touches the public API, the changes have been approved in a separate issue with the "api-approved" label.If the PR changes the public API the changes needs to be included by running AcceptApiChanges.ps1 or AcceptApiChanges.sh.If the PR affects the documentation, please include your changes in this pull request so the documentation will appear on the website../build.sh --target spellcheckor.\build.ps1 --target spellcheckbefore pushing and check the good outcome