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
| internal static Framework FromJson(JsonObject jobject) | ||
| { | ||
| 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.
@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.
Yes, this is by design -- Any coercions from bool to string will need to be performed explicitly by the user.
| { | ||
| 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.
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.
There were a lot of API changes between v4 and the latest v6. AssertionScope.Succeeded etc. are not available on public surface anymore.
FailWithwould always go through the theFluentAssertionsformatter 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).
|
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).