-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Migrate host.tests from Newtonsoft to STJ #76901
Migrate host.tests from Newtonsoft to STJ #76901
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Newtonsoft |
de46dd7
to
c43f539
Compare
6b70fd4
to
1e266f6
Compare
1e266f6
to
608150a
Compare
{ | ||
return new Framework((string)jobject["name"], (string)jobject["version"]) | ||
return new Framework(jobject["name"].ToString(), jobject["version"].ToString()) |
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.
@eiriktsarpalis, the reason for changing this line was; given these two files:
{ "name": "foo" }
{ "name": false }
first one successfully casts to string but second one throws an exception about 'False' type
conversion to System.String
.
If this is not an intentional decision then IMO, we should allow explicit cast to string on JsonNode
for all JSON types.
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.
Yes, this is by design -- Any coercions from bool to string will need to be performed explicitly by the user.
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.
DependencyModel tests LGTM
@@ -21,121 +21,121 @@ public CommandResultAssertions(CommandResult commandResult) | |||
public AndConstraint<CommandResultAssertions> ExitWith(int expectedExitCode) | |||
{ | |||
Execute.Assertion.ForCondition(Result.ExitCode == expectedExitCode) | |||
.FailWithPreformatted($"Expected command to exit with {expectedExitCode} but it did not.{GetDiagnosticsInfo()}"); | |||
.FailWith($"Expected command to exit with {expectedExitCode} but it did not.{GetDiagnosticsInfo()}"); |
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 thought we had to explicitly use our extension and AddFailure
(or I guess AddPreFormattedFailure
in newer versions) because FailWith
would always go through the the FluentAssertions
formatter which messed with things like newlines. Does the new version not do that anymore?
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.
There were a lot of API changes between v4 and the latest v6. AssertionScope.Succeeded etc. are not available on public surface anymore.
FailWith
would always go through the theFluentAssertions
formatter which messed with things like newlines.
If this is still a problem, we can change the behavior with AssertionOptions.FormattingOptions.UseLineBreaks = true
(or fluent API .UsingLineBreaks
).
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.
Thanks!
Ready to merge? :) cc @ilonatommy, in case we want to drop |
Ah, thanks for the ping. Are the wasm failures pre-existing/known? cc @lewing @radical
|
The wasm failures are being hit only when the tests are trimmed. So, this is likely missing something that needs to be preserved, like in https://github.com/dotnet/runtime/blob/main/eng/testing/ILLinkDescriptors/ILLink.Descriptors.Castle.xml |
Remaining failures are unrelated #77282. |
Thanks, @am11! |
Also updated FluentAssertions and Moq packages to latest versions (which are available in internal nuget feed).